In jQuery 1.3.2 – jQuery('#id').data(elem) returned the id ? I’m wondering how to do the same thing using jQuery 1.6.2 ?
Understanding now is that it returns the object as opposed to the id as it was in jQuery 1.3.2 ?
How can I get the id ?
Edit: sorry for not clarifying – the .data key/value pair – because I’m upgrading from 1.3.2 and .data(elem) is no longer returning the ID – and im unsure how to get it using 1.6.2 ?
Your question shows:
But I assume this does not reflect what you actually want.
I’m guessing you’re really doing:
As in:
Example: http://jsfiddle.net/Xd3km/
…which (in
jQuery 1.3.2) does not give the ID of the element, but rather the ID representing the element injQuery.cache.I’m pretty sure you can’t do this as of
jQuery 1.4. Furthermore, I’m not sure why this number would be useful. Especially since the structure ofjQuery.cacheis meant for internal use, and is subject to change.Doing
jQuery.data( elem )now gives you the data object associated with that element injQuery.cache. It should provide anything that is really useful to you.