[jQuery] Syntax for selecting a form element named 'foo[0]'?
Greetings; I have a form on my page that contains two select fields.
They are
setup like this:
<form id="myForm">
<select onchange="_hs_swapOptions(this.form, 'categoryID', 0);"
name="categoryID[0]">
<option value="12">hello</option>
<option value="11">world</option>
</select>
<select name="categoryID[1]">
<option value="22">foo</option>
<option value="21">bar</option>
</select>
</form>
I've tried various permutations to be able to grab the values from the
two selects with no
success. Here are some of the statements I have tried:
$('select[@name=categoryID[0]]').val();
$('select[@name=categoryID\[0\]]').val();
$('select[@name=categoryID][0]').val();
$('select[@name=categoryID.0]').val();
What magic am I missing to be able to grab the value?