<select>
<option value="0" id="n">n</option>
<option value="1" id="m">m</option>
</select>
In jQuery, how do I make the option 'selected' for id=m?
Set an id on the select element instead:
<select id="TheDropDown">
<option value="0">n</option>
<option value="1">m</option>
</select>
Then use the val
function:
$('#TheDropDown').val('1');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With