问题:
I was wondering if it's possible to get jQuery to select an <option>
, say the 4th item, in a dropdown box?我想知道是否有可能让 jQuery 在下拉框中选择一个<option>
,比如第四个项目?
<select>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
I want the user to click a link, then have the <select>
box change its value, as if the user has selected it by clicking on the <option>
.我希望用户单击一个链接,然后让<select>
框更改其值,就好像用户通过单击<option>
选择了它一样。
解决方案:
参考一: https://en.stackoom.com/question/KPVc参考二: https://stackoom.com/question/KPVc