Is it possible to loop through a data()
object?
Suppose this is my code:
$('#mydiv').data('bar','lorem');
$('#mydiv').data('foo','ipsum');
$('#mydiv').data('cam','dolores');
How do I loop through this? Can each()
be used for this?
eachjqueryloops
Is it possible to loop through a data()
object?
Suppose this is my code:
$('#mydiv').data('bar','lorem');
$('#mydiv').data('foo','ipsum');
$('#mydiv').data('cam','dolores');
How do I loop through this? Can each()
be used for this?
Best Solution
This will iterate through each property in 'this' element's data object.