JS implementation of the text box content changes immediately to trigger the incident:
This chapter introduces how to change the content of the text box when the content of the text box is changed, and immediately triggers an event to perform a response operation, rather than like the keydow or keyup event. Code examples do a brief introduction.
1. Related knowledge preparation:
This incident will change when the element content is changed and it is triggered when the focus is lost.
This incident will be triggered immediately when the element content changes, and this event is triggered even through the content of JS.
Any attribute changes in the
element will trigger the event, not just value.
Only browser below IE11 supports this incident.
This incident will be triggered when the value attribute value is changed, and the value of the value attribute is not triggered by JS.
Only be supported by standard browsers such as IE8 or Google Firefox.
2. Code instance:
Since we know the characteristics of each event, we can realize the code compatible with each browser through compatibility methods.
code is as follows:
The above your code is basically compatible with each browser. The code implementation process is not introduced here.