jquery - javascript .on() function not working -


i have select list, #select1 , when user chooses option list, action happens. tried following javascript code sadly not working:

script

jquery(document).ready(function(){     $( document ).on( "change", "#select1", function() {         alert("test");     }); }); 

so when choose option, don't test alert.

any idea why happening?

edit

html

<select id="select1">       <option selected="selected" disabled="disabled">choose country</option>       <option value="2">canada</option>       <option value="3">france</option>       <option value="4">india</option>       <option value="5">poland</option>       </select> 

i think work

$('body').on('change','#select1',function(){     alert("test"); }); 

demo here


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -