沒有事件在更改下拉值時被激發。請,有人可以告訴我哪裏可以出錯嗎?Dropdown onchange事件在Wordpress中未被解僱
JS代碼
jQuery(document).ready(function($){
jQuery('#_ccounts select').on('change', function(){
var acc = jQuery(this).val();
alert(acc);
});
});
HTML代碼
<label for="_accounts">Accounts</label>
<select id="_accounts" name="accounts">
<option value="" disabled="disabled" selected="selected">Select an account..</option>
<option value="1">abc</option><option value="2"DEF</option> </select>
ID是唯一的,所以ID足夠選擇器和錯字錯過了在ID選擇器 – JYoThI