Home > Article > Web Front-end > Use onpropertychange and oninput events to solve the shortcomings of onchange events in javascript development_jquery
onchange has an obvious shortcoming when used in a text box input box. The event will not be triggered with the input of text, but will be triggered when the text box loses focus (onblur). That is, there is no immediacy. !
In IE, you can use onpropertychange to replace the onchange event. When there is any change in the text box, can trigger the event immediately.
This way the problem is solved.
What about other browsers? onpropertychange is a patent of IE. Next is the oninput event.
But there is something strange about oninput. You must use addEventListener to bind events. Otherwise it will be invalid.
Okay, the following is a demonstration example, no problem with mainstream browsers: