0
我有一個頁面,下拉動態創建類「issueDropDown」。我試圖檢查頁面中的所有下拉類與「issueDropDown」,以查看他們是否被更改或不。基本上,如果每個下拉列表(其被禁用)的selectedIndex仍然設置,我執行一些操作。jQuery Check 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);
});