可以通过selectedindex属性来实现自动选择某项的功能。
<select id="opS">
<option value="1"> a</option>
<option value="2"> b</option>
<option value="3"> c</option>
</select>
<script>
$("opS").selectIndex = 3; //选择 c
</script>
本文介绍了一种使用selectedindex属性自动选择下拉菜单中特定项的方法。通过设置select元素的selectedindex属性为指定值,可以实现在页面加载时自动选中对应的选项。
688

被折叠的 条评论
为什么被折叠?



