Of course there is nothing wrong if you implement onChange event using the traditional way, that is by adding onchange=”" attribute to the HTML element. However, your codes can be better in some ways if you do it using jQuery.
Onchange event is called change() in jQuery. We include jQuery keyup() event (onkeyup event in JS) too so that it can detect the change when user change their selection using keyboard arrows. For more information and real example, please visit the demo page below.
This example page demonstrates 2 different ways to add onchange event to a select box. One using the traditional way, another using jQuery. Feel free to view the source to learn more and use the codes wherever you want.
Of course, the downfall of having jQuery in your page are increased bandwidth and page loading time, to load the extra 60kb of javascripts. However, if you are already using jQuery in your website, this is definitely the method you should go for.
Still quite bad with jQuery but these small tips help tremendously! also love that you include a example page instead of a screenshot gives you so much more to go on! Keep it up :)
Hiya,
Were you aware this does not work in Chrome?
Mike
I just tried again and it works for me. In fact chrome is my main browser