onchange Event in JavaScript
onchange Event in JavaScript
The onchange event fires the moment when the value of the element is changed.
For your Information:-
It is much similar to oninput event but the difference is that oninput event occurs when the element value changes while in the case of onchange attribute the event occurs when the element loses focus. Moreover, onchange works with select elements.
Syntax:-
Its syntax is:- < element onchange="my_script" > OR object.onchange= function(){my_script} OR object.addEventListener("change", my_script)