jQuery has three event handlers for the keyboard; keydown, keypress, and keyup. If you're a little bit like me, you'll go: "What do you need three for? You press down on the key and you let go. It's one press, down and up again." But, Quirksmode says this about the key events:
"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."
This is all great, but what do you actually get out of these events?
From the DOM, you can retrieve the 'keycode', 'key', 'charcode', 'char', and 'which' values related to the key event.
Oddly enough the results vary from one browser to the next, especially with 'keycode' and 'charcode', so be careful.
The 'which' values seem to stay consistent between the major browsers, so it may be a good ideato use 'which' over 'keycode' and 'charcode'.
The 'keypress' event returns a number which is the ascii number of the character. If you use a foreign language keyboard, 'keypress' will return the correct ascii value, while 'keydown' and 'keyup' return nothing.
The only reason I can see for using 'keydown' or 'keyup' would be to track the 'shift', 'ctrl', 'alt', or other special control characters.
So who wins? Well, I favor 'keypress', since handling control characters usually gives me a headache.