input input box change and blur the difference between events

blur performance and change events are very similar in most cases, after the end of input, leave input box, it will have to trigger change and blur , the only two exceptions.

1, without any input, will not trigger change

In this case the out of focus, the input box and does not trigger a change event, but it will trigger the blur event. In determining the form of the modified state, this difference can be very useful, by change event can easily find which fields has been changed at the track and change its value.

2, the input value after the change did not happen

This situation means that, in the absence of the defocus, be deleted in the input frame to the input operation, but the original value with the same final value, the out of focus, keydown, input, keyup, blur will in this case trigger, but the change still does not trigger.

Guess you like

Origin www.cnblogs.com/lvonve/p/11994092.html