sorry for my bad english
i am working in javascript and i have build an array i want to enter values in this array.
var attribute_sets = [];
$('.attribute_set :selected').each(function(i, selected){
attribute_sets[i]['id'] = $(selected).val(); // getting id
attribute_sets[i]['name'] = $(selected).text(); // getting name
});
Its giving me error
TypeError: attribute_sets[i] is undefined
also tried this one
attribute_sets[i]['id'].push($wk_jq(selected).val());
still getting same error
can any one please guide me how can i insert values in this JS array. i want output like this
array
[0]
'id':'1',
'name':'abc'
[1]
'id':'2',
'name':'xyz'