tags:

views:

351

answers:

0

The code snippet is here

If I replace keypress with keyup or keydown, it works fine. As per jQuery documentation event.which should work fine.

Update:

Very bottom of this page says:

If you need to detect these keys, do yourself a favour and search for their keyCode onkeydown/up, and ignore both onkeypress and charCode.

Looks like keypress is not very reliable.

Update2:

keypress event does work in firefox and in Safari. However it does not detect left and right arrow keypress. http://docs.jquery.com/Events/keypress