Fortunately, there are propertychange (IE) and oninput events.
Oninput is an event in a standard browser and is generally applied to the input element. It will occur when the input value changes, and it can be listened to in real time whether it is keyboard input or mouse paste changes.
Browser compatible
IE9 is not supported. At this time, IE's proprietary propertychange event must be used. As the name suggests, it is translated as an attribute change event. This event is relatively powerful. It not only listens to the value attribute of the input, but also includes the properties of other tags and various attributes that will change, such as the style attribute of the span element. When an event occurs, you can also use event.propertyName to access the changed property name.