Get hash string / guid from jQuery object

I would like to have a hash table of jQuery objects and they need some kind of unique identifier.

DOM representation is simple

<tr>
    ...
</tr>

And I would like to add jQuery objects <tr>to the hash table

hash[$(trObject).guid()] = $(trObject);

How can I uniquely identify a specific jQuery object without a jQuery extension?

I know that I can write a method

(function() {
    var guid = 0;
    $.fn.guid = function() {
         var node = this[0];
         if (node.guid === undefined) {
              node.guid = guid++;
         }
         return node.guid;
    };
}());

To do this for me, but I'd rather know if there is some kind of native standard way to get the string / int hash code from a jQuery object.

PS I do not expect to hit the 32-bit integer limit.

+5
source share
1 answer

, , jquery
. http://plugins.jquery.com/project/GUID_Helper

:
, jquery, jquery.guid
, jquery - . , .

+1

All Articles