What’s the difference between keyup, keydown, keypress and input events?

According to jQuery docs:

The keypress event is sent to an element when the browser registers keyboard input. This is similar to the keydown event, except that modifier and non-printing keys such as Shift, Esc, and delete trigger keydown events but not keypress events. Other differences between the two events may arise depending on platform and browser.

The keyup event is sent to an element when the user releases a key on the keyboard.

The oninput event it’s an event that triggers whenever the input changes.

However the input event is not supported in IE version below 9. In that case, you could use proprietary event onpropertychange, it does the same as oninput.

But in your case, you could use the paste and change event together. You should use change too because paste only happens on browsers that support it on an explicit paste.

Leave a Comment