If you press a button it fires a keydown
and releasing it fires a keyup
. The keypress
usually comes between those two.
keydown
and keyup
talk about which key has been changed. keypress
tells which character that key represents.
Note that this is all browser-dependent!
See this article about the differences between the key events as implemented on various browsers.