What is the difference between these three events? Upon googling I found that:
- The
onKeyDown
event is triggered when the user pre
onkeydown
is fired when the key is down (like in shortcuts; for example, in Ctrl+A
, Ctrl
is held 'down'.
onkeyup
is fired when the key is released (including modifier/etc keys)
onkeypress
is fired as a combination of onkeydown
and onkeyup
, or depending on keyboard repeat (when onkeyup
isn't fired). (this repeat behaviour is something that I haven't tested. If you do test, add a comment!)
textInput
(webkit only) is fired when some text is entered (for example, Shift+A
would enter uppercase 'A', but Ctrl+A
would select text and not enter any text input. In that case, all other events are fired)