jQuery attach click event on empty select box -
using jquery, how load select box options dynamically while clicking on select box.
i using redmine rest api's load issue categories dynamically in select box.
how attach event handler selectbox.
but not working, i.e event not attaching
<script> //dynamically load status values $('#newstatusfield').on('click',function(){ alert('inside'); }); </script> <select name="status" id="newstatusfield" data-mini="true" data-native-menu="false"> <!--dynamic option values --> </select>
always try wrap jquery code inside document.ready fucntion , change event work :
edit : include latest jquery library can download here jquery library
<head> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script> $(document).ready(function() { $('#newstatusfield').on('change',function(){ alert('inside'); }); }); </script> </head>
Comments
Post a Comment