Answers for "how to set default value in select option using javascript"

8

select default value

<option selected>
5
</option>
Posted by: Guest on April-03-2020
0

html select specify deafult select by js variable

$(function() {
    var temp="a"; 
    $("#MySelect").val(temp);
});

<select name="MySelect" id="MySelect">
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
</select>
Posted by: Guest on November-22-2020

Code answers related to "how to set default value in select option using javascript"

Browse Popular Code Answers by Language