My following code for checking whether Capslock is on or not works fine on \"onkeypress\" event.
But i want it for \"onfocus\" event. i tried replacing \"onkeypress\" w
There is a jQuery plugin called capslockstate which will keep track of the state of the caps lock key, allowing you to use that information as and when needed.
It will monitor the state for the entire page, and then you can retrieve the state when the desired element gains focus.
It's also based on watching key presses, but not limited to lower ASCII characters and handles situations like the Caps Lock key itself being pressed.
Your situation would become something like:
Caps Lock is on.
Note that I've only jQueryified the essential bits, more could still be done.