onchange attribute used to call the onChange JavaScript function when the drop-down list value changed.
The onChange JavaScript function display an alert message with the selected value.
Output for onchange Attribute in HTML:
The output shows the drop-down list and user try to change the value.
When user try to change the value HTML to PHP the alert box show an message as “The Value Changed as : PHP”
Browser Support for onchange Attribute in HTML:
Yes
Yes
Yes
Yes
Yes
Tips and Notes
The onchange event is similar to the oninput event.
The difference is which the oninput event shows suddenly after the value of an element has changed, although onchange event shows when the element drops focus.