Introduction to the trigger event for the content change of the input tag

  • 2020-03-30 03:25:33
  • OfStack

1. Difference between onchange event and onpropertychange event:

The onchange event is triggered when the content changes (the two contents may be equal) and the focus is lost. The onpropertychange event is triggered in real time, every character added or deleted will be triggered, and the event will also be triggered through js changes, but the event is IE exclusive.

2. Difference between oninput event and onpropertychange event:

3. Failure of oninput and onpropertychange:

The oninput events:

(1) when the value is changed in the script, it will not be triggered;

(2) it will not be triggered when selected from the automatic drop-down prompt of the browser;

Onpropertychange event:

When the input is set to disable=true, it is not triggered.


Related articles: