javascript - Select the first enabled option in a select element -
how set value of select element first enabled option? have html this:
<select name="myselect" id="myselect"> <option value="val1" disabled>value 1</option> <option value="val2">value 2</option> <option value="val3" disabled>value 3</option> <option value="val4">value 4</option> </select>
how select first option isn't disabled (here val2)?
try selecting first option enabled.
$('#myselect').children('option:enabled').eq(0).prop('selected',true);
.children()
finding list of option enabled , .eq(0)
choosing first entry on list , using .prop()
select option
Comments
Post a Comment