html select specify deafult select by js variable

Solutions on MaxInterview for html select specify deafult select by js variable by the best coders in the world

showing results for - "html select specify deafult select by js variable"
Alessandra
14 Oct 2017
1$(function() {
2    var temp="a"; 
3    $("#MySelect").val(temp);
4});
5
6<select name="MySelect" id="MySelect">
7    <option value="a">a</option>
8    <option value="b">b</option>
9    <option value="c">c</option>
10</select>
11