I want to register the onchange event in this selection field.
<select id="demo"> <option>Apple</option> <option>Orange</option> <option>Banana</option> </select>
Two versions of jQuery are included on my page, which are shared using noConflict
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $m = $.noConflict(true); </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
I put this code in a script tag.
<script> $("div#hello").on("change","select#demo",function (){ console.log("in $ on function"); }); $m("select#demo").on("change",function(){ console.log("in $m on function"); }); </script>
I raised the onchange event on selectbox using
$("#demo").val("Orange").trigger("change")
then he performs
$("#demo").on("change",function(){..})
but not fulfill the second
($m("#demo")..)
How can I raise an onchange event that fires both event handlers ($ and $m) ?
jquery javascript-events jquery-events
Darshit patel
source share