Jquery data() storage

data-storage, jquery

Solution

see the content from jquery

The jQuery.data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore free from memory leaks. jQuery ensures that the data is removed when DOM elements are removed via jQuery methods, and when the user leaves the page. We can set several distinct values for a single element and retrieve them later:

Problem

Can any one tell me where jquery `data()` stores the data and when it is get erased and how? Is there any performance issue if I use this to store ajax call result? For example: ``` $("body").data("test", { myData: 'abcd'}); ```

Original source