我有一个页面,其中下拉列表是使用“issueDropDown”类动态创建的。我正在尝试使用“issueDropDown”类检查所有下拉列表的页面,以查看它们是否已更改。基本上,如果每个下拉列表的 selectedIndex (禁用)仍然设置,我执行一些操作。
例子:
<select class='issueDropDown'>
<option selected disabled>Select Type</option>
<option value="1">Type 1</option>
<option value="2">Type 2</option>
</select>
到目前为止我所拥有的不起作用(不检查每个):
$('body').on('change', '.issueDropDown', function() {
$('.issueDropDown').change(function(){
var selIndex = $(".issueDropDown").filter(function(){
return this.selectedIndex > 0;
}).length;
// I'll execute something here once I check that it's still "Select Type"
alert('test: ' + selIndex);
});