I have written a piece of javascript code to get the key pressed within a text area. I have used the onkeydown event to capture the key pressed and am calling a function whe
The issue is that keydown
event will report keypresses - that is, physical keys pressed. The keypress
event will report the translated keys, meaning the character that has been derived from the keys pressed (Shift + a == A
). In order to get the actual keys, you may need to keep track of both keydown
/keyup
(to monitor the modifier keys) and keypress
(to monitor the actual alphanumeric user input.)