jquery.data(key, value)
$('#something').data('foo', 52);
alert($('#something').data('foo'));
http://answers.oreilly.com/topic/1634-how-to-attach-objects-and-data-to-dom-with-jquery-data-to-avoid-memory-leak-issues/
How to attach objects and data to DOM with jQuery.data to avoid memory leak issues
Properties added to an object or DOM node at runtime (called expandos) exhibit a number of issues because of flawed garbage collection implementations in some web browsers. This excerpt from jQuery Cookbook shows you how to avoid memory leak issues by using
.data()
.
No comments:
Post a Comment