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.
or Subscribe to specific category only :