Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 736487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:36:37+00:00 2026-05-14T07:36:37+00:00

I’m sure we’ve all done this before: <a id=232 rel=link_to_user name=user_details class=list hoverable clickable

  • 0

I’m sure we’ve all done this before:

<a id="232" rel="link_to_user" name="user_details" class="list hoverable clickable selectable">
USER #232
</a>

But then we say, oh my, I need more ways to store tracking info about this div!

<a id="232-343-22" rel="link_to_user:fotomeshed" name="user_details" class="groupcolor-45 elements-698 list hoverable clickable selectable">
User: John Doe
</a>

And the sickness keeps growing. We just keep on packing it inside that poor little element and it’s attributes. All so we can keep track of who it is.

So with my limited knowledge of JS, someone please tell me how to do something like this:

<a id="33">USER #33</a>

$(#33).attr({title:'User Record','username':'john', 'group_color':'green', 'element_num':78});

So here we just added what I would call invisible attributes, because we just played God and made those attributes up on the fly like it was no problem. The cool part is that these would be kept in their own little object somewhere in variable land. NOT in the tag itself.

Then later on, in a code nested far far away, be able to say, oh, i wonder what group_color John is…

user_group_color = $(table).find(a['username':'john']).attr('group_color');

THEN BAM!!!! POW!!!!

alert(user_group_color + " is a bitchin color!");

You get to know his group color… all without adding a bunch of bloated element tracking nonsense into our tags.

So does this sort of thing exist? If not, how do I make it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:36:38+00:00Added an answer on May 14, 2026 at 7:36 am

    You can use .data() for just this purpose :), like this:

    $("#33").data({title:'User Record','username':'john', 'group_color':'green', 'element_num':78});
    

    Note: IDs can’t start with a number, ignoring that to match your example!

    And to get the value:

    user_group_color = $('table').find('a').data('group_color');
    

    If you needed to find by username still, use .filter() like this:

    user_group_color = $('table').find('a').filter(function() {
      return $(this).data('username') === 'john';
    }).data('group_color');
    

    Not directly to the question, but possibly a time-saver. You could make this a selector as well, like this:

    jQuery.expr[":"].username = function(a, b, m) {
      return jQuery(a).data('username') == m[3];
    };
    

    Then fetching the element by username would look like:

    user_group_color = $('table').find('a:username(john)').data('group_color');
    

    You see the pattern, just use this for any commonly used attribute you need to filter by.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data like this: 1 2 3 4 5 9 2 6
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.