The keyup
event is fired when a key is released.
The keydown
and keyup
events provide a code indicating which key is pressed, while keypress
indicates which character was entered. For example, a lowercase "a" will be reported as 65 by keydown
and keyup
, but as 97 by keypress
. An uppercase "A" is reported as 65 by all events.
The event target of a key event is the currently focused element which is processing the keyboard activity. This includes: <a>
, bubbles. It can reach Window
.
The event target might change between different key events. For example, the keydown
target for pressing the Tab key would be different from the keyup
target, because the focus has changed.