Background:
In a mobile H5 development, it is necessary to listen for real-time changes in the input box values.
The onchange event must be abandoned because it can only be triggered by losing focus.
While keyPress can be triggered on Android, iOS is not available.
Don't want to use both Android and iOS to trigger keyDown and keyUp.
So, Baidu has a new thing:oninput! "Need to work with PropertyChange, compatible with IE9 versions below"
Usage:
Js:
if (Isie) {document.getElementById ("input"). Onpropertychange = keys (); } else {document.getElementById ("input"). AddEventListener ("input", keys, false);}
Jquery:
$ (' input '). Bind ('input propertychange', function () {//For related operations});
Note that the following wording does not support :
n/a!
$ (' input '). Input (function () {//For related operations});
Reference:JS and jquery real-time monitoring input box value Oninput and Onpropertychange method
Mobile with JS and jquery real-time monitoring input box value changes