基于价值选择期权
这个问题在这里已经有了答案:
只需在<select>
标签上设置值即可:
$('#options').val(userFont);
$(function() {
$("#options").val("three");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<select id="options">
<option value="one">One</option>
<option value="two" selected>Two</option>
<option value="three">Three</option>
</select>
链接地址: http://www.djcxy.com/p/83913.html
上一篇: Selecting Option Based on Value
下一篇: How can I change the selected option of a select box using jQuery