Hi,

this has nothing to do with JQuery directly but since the brightest 
minds are around in this mailing list and this should be of general 
interest...

What I am trying to do is to pass values along with a tag, so I can use 
that values on a mouse click or so. A short example:

<ul>
  <li id="li_123">Johnny</li>
  <li id="li_345">Nina</li>
  <li id="li_54">Olga</li>
</ul>

Now I could do something like this (pseudocode, might not work):

$('ul>li').click(function(){
  var userId = $(this).attr('id').split('_')[1];
  $.get('doSomething.php?userId=userId');
});

But it's an ugly workaround, most of the times I wouldn't want to use 
the id-attribute like this and I am not sure if any other HTML universal 
attribute can be used for this purpose. I have seen some other 
implementations of this technique for tooltips for example. Stefan uses 
it for his great Interface library where he takes the title tag's value 
as an input for the tooltip text. It is even semantically ok:

  <a href="http://www.yahoo.com"; title="Link to Yahoo">Yahoo</a>


My question is: do you use similar techniques and what benefits/problems 
to they bring with? What are the alternatives?

Cheers, Arash


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to