I'm trying to understand a jquery script which stores an object using jquery data().
Is there an easy way to retrieve all information stored? Especially since I don't know all of the keys that have been used.
Thanks for help!
I'm trying to understand a jquery script which stores an object using jquery data().
Is there an easy way to retrieve all information stored? Especially since I don't know all of the keys that have been used.
Thanks for help!
If you call .data()
with no arguments, it returns what you want.
var allData = $('some-element-selector').data();
for (var k in allData)
{
if (allData.hasOwnProperty(k))
{
console.log(k + ':' + allData[k]);
}
}