I have a select list with the following markup:
<select name="dropdown[users]">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">2</option>
</select>
I want to get the value of the select list option.
how is this done is jQuery?
I have tried:
$('select[name="dropdown[users]"]');
This doesn’t seem to work
Any ideas?
Use
val():Example fiddle
The fact the name has
[]in it is not a factor as you have enclosed the attribute value in quotes.If you removed the quotes, you would need to escape the braces with
\\, like this: