Reputation: 411
Is it possible to get the number of data stored on an element an then iterate through them ?
For example i would like to do something like :
for(;elmt.data().length<i++;){
//iterate thro elmt.data
}
Upvotes: 2
Views: 119
Reputation: 2625
.data()
returns an object that has no attribute length
,
but this will work:
$.each($('#someElement').data(), function (key, value) {
console.log(key,value);
});
Upvotes: 4