I have a requirement to supply values from 2 select boxes to an Action Method. I\'d like to know if there\'s a way to automatically extract all of the attributes from the select
You'd best do this with map():
var valuesArray = $("select").map(function() {
return $(this).find(":selected").val();
});
The above returns an array of values. You may need to identify the source of each value, in which case you'll need something like:
var values = {};
$("#select").each(function() {
values[$(this).attr("name")] = $(this).find(":selected").val();
});
which creates an anonymous object of all the <select>
values.