【发布时间】:2013-05-20 07:46:46
【问题描述】:
我不想在<select> 元素的数组上写一个临时布尔值$.each() 并查找是否是prop('selectedIndex') > 0,我想做类似的事情:
$('select[id^="idPrefixForTheArrayOfSelects-"][selectedIndex="0"]').length == 0
但它不起作用。
是否可以按值、selectedIndex等进行选择?
【问题讨论】:
-
selectedIndex是一个属性而不是选择的属性。你所拥有的是一个属性选择器。阅读更多stackoverflow.com/a/5876747/297641
标签: jquery select jquery-selectors selectedindex