I have the following HTML with data attributes - I want to write some jQuery that will loop through the HTML and collect the data attributes and put them into an array - cou
item is not a jQuery object, the arguments for each are the index and the native DOM element
var multi = $('.winners');
var winners_array = [];
$.each(multi, function (index, item) {
winners_array.push( {name: 'fullname', value: $(item).data('fullname')} );
});
using a map would be easier
var winners_array = $.map($('.winners'), function(el) {
return {name: 'fullname', value: $(el).data('fullname')}
});