0

而不是写一个临时布尔值,一个元素$.each()数组,并找到 if one's ,我想做一些类似的事情:<select>prop('selectedIndex') > 0

$('select[id^="idPrefixForTheArrayOfSelects-"][selectedIndex="0"]').length == 0

但它不起作用。

是否可以按值、selectedIndex 等进行选择?

4

1 回答 1

5

你可以这样做 -

$('select[id^="idPrefixForTheArrayOfSelects-"]').filter(function(){
 return this.selectedIndex === 0;
}).length == 0
于 2013-05-24T16:24:16.390 回答