Hi Klaus, thanks for your answer and your hint to w3! So it seems to be a common technique. I was wondering if I am the only one doing this, but it's good to know that I have accomplices out there ;-)
Cheers, Arash Klaus Hartl schrieb: >Arash, you could as an alternative use the class attribute for that, but >theres no need to feel false about the id as well. From the HTML Spec: > > >The id attribute has several roles in HTML: > > * As a style sheet selector. > * As a target anchor for hypertext links. > * As a means to reference a particular element from a script. > * As the name of a declared OBJECT element. > * For general purpose processing by user agents (e.g. for >identifying fields when extracting data from HTML pages into a database, >translating HTML documents into other formats, etc.). > >The class attribute, on the other hand, assigns one or more class names >to an element; the element may be said to belong to these classes. A >class name may be shared by several element instances. The class >attribute has several roles in HTML: > > * As a style sheet selector (when an author wishes to assign style >information to a set of elements). > * For general purpose processing by user agents. > > >http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.2 > > >-- klaus > > > >Arash Yalpani schrieb: > > >>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 >> >> -- Arash Yalpani Entwicklung browserbasierter Software-Anwendungen Prenzlauer Allee 173 | 10409 Berlin [EMAIL PROTECTED] | http://www.yalpani.de _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
