Onchange Event Using JQuery



Normal Onchange Event




Both works the same way when you change the selection using mouse or keyboard arrows. In this example, a function will be run and the result of your selection will be displayed below the select box.

The main difference is, after the page load, jQuery is able to automatically run the event once, thus displays the result first. This can be very useful when you need this feature, so that you wouldn't have to write another piece of javascript code to archieve the same thing.

You can remove this "auto run" feature by removing the ".change()" at the end of the jquery script.



ZENVERSE  //  Premium Wordpress Themes