I have the initial array in the following way:
var bankNamesList = [{
'BARODA': 'BARODA'
}, {
'AB': 'AB'
}];
Then i am looping the values and appended to main variable and constructing a drop-down
var bankNames = '<ul class="root" id="exp-bank-names">';
$.each(bankNamesList, function() {
$.each(this, function(name, value) {
bankNames += '<li><a href="#" name="' + name + '">' + value + '</a></li>';
});
});
bankNames += '</ul>';
$('.submenu-bank-list').html(bankNames);
How do i push the new value in to an array.
i tried in the following way, but no luck.
var nameAttr = 'SBI';
bankNamesList.push({nameAttr:nameAttr});