On my html page, I have a variable number of dropdown boxes, each with the following code:
<select name="gearquan[]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
If using a regular form submit, it sends as a nested array. I'm trying to convert my forms over to using jquery and ajax. When I had a list of checkboxes I used the following code to get their values:
var gear = new Array();
$("input:checked").each(function() {
gear.push($(this).val());
});
What would I need to change in that, in order to get the values of the dropdown boxes? (Other than changing gear to gearquan)
gear.push($('select').val());should make more sense (you dont need.eachas you can have just one value from select element.