如何使用 jQuery 选择下拉选项? - How to use jQuery to select a dropdown option?

问题:

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章