問題:
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