I have a HTML select like this:
and I have a variable named temp
in my JavaScript:
var temp = "a";
Now I want to set the value of the option that is equal to temp as default value for my select.
How can I do it?
Answer
$(function() {
var temp="a";
$("#MySelect").val(temp);
});
No comments:
Post a Comment