Dropdown onchange event not getting fired at all in WordPress

No event is getting fired on changing the dropdown value. Please, can someone tell me where I can be going wrong?

JS code

jQuery(document).ready(function($){
    jQuery('#_ccounts select').on('change', function(){
        var acc = jQuery(this).val();
        alert(acc);
    });
});

Html Code

    <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>

Read more here: Dropdown onchange event not getting fired at all in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *