This method is a shortcut for .on( "change", handler ) in the first two variations, and .trigger( "change" ) in the third.

In this post, we will see how to get selected value of dropdown in JavaScript and jQuery onchange event. In if condition we are comparing the user selected value with dropdown value. In the else part we write when the value is not equal to 2 then the text box should be hidden. Last Updated: 22-04-2019 With jQuery, it is easy to writing one line of code to change the selected value from a drop-down list. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element … Here we are using an if else statement. This event is limited to elements,