I have a variable list of elements and need to get their names and values in pairs (associative array or object).
So far I have the following but how do I create the pairs of name and value for each element ?
var names = [];
var values = [];
$('.modalField').each(function() {
fieldName = $(this).attr('name');
fieldVal = $(this).val();
names.push(fieldName);
values.push(fieldVal);
});
Thanks for any help,
Tom