The keydown, keypress and keyup events fire when the user presses a key.
- keydown
- Fires when the user depresses a key. It repeats while the user keeps the key depressed.
- keypress
- Fires when an actual character is being inserted in, for instance, a text input. It repeats while the user keeps the key depressed.
- keyup
- Fires when the user releases a key, after the default action of that key has been performed.
- textinput
- Fires when a character is actually added to a control. So if the user presses a character key, but the default is prevented onkeydown or onkeypress, the textinput event does not fire since the sequence does not result in a character being added.
From article: http://www.quirksmode.org/dom/events/keys.html