我知道有很多類似的問題,但我仍然找不到一個關於我的確切問題的問題。我沒有得到我的<select>
的selector
;我正在迭代表單域,所以我只能通過$(this)
訪問我的select
。
我該如何使用jQuery
的'.each'函數迭代這個select
的選項?
我試圖鏈,但是,這並不工作:
$(this).$('option').each(function(){
if (this.value == val) {
// do something
}
});
注:$(this)
是我select
不是我form
。
什麼about:'$(this).find('option:selected')。doSomething()。orWhatever();'。你真的會更好地解釋你正在尋找的是 – 2014-10-31 10:44:50