I've read all the answers on to this questions and none of the solutions seem to work.
Also, I am getting the vibe that triggering keypress with special characters does not work at all. Can someone verify who has done this?
I've read all the answers on to this questions and none of the solutions seem to work.
Also, I am getting the vibe that triggering keypress with special characters does not work at all. Can someone verify who has done this?
Of you want to do it in a single line you can use
The real answer has to include keyCode:
Even though jQuery's website says that which and keyCode are normalized they are very badly mistaken. It's always safest to do the standard cross-browser checks for e.which and e.keyCode and in this case just define both.
If you're using jQuery UI too, you can do like this:
it can be also accomplished like this (docs)
Ok, for me that work with this...
Slightly more concise now with jQuery 1.6+:
(If you're not using jQuery UI, sub in the appropriate keycode instead.)