This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
For constants equivalent to these numeric codes, see
Do not use this property anymore, it is deprecated
var value = event.charCode;
valueis the Unicode value of the character key that was pressed.
keypress event, the Unicode value of the key pressed is stored in either the
charCode property, never both. If the key pressed generates a character (e.g. 'a'),
charCode is set to the code of that character, respecting the letter case. (i.e.
charCode takes into account whether the shift key is held down). Otherwise, the code of the pressed key is stored in
When one or more modifier keys are pressed, there are some complex rules for
charCode, see Gecko Keypress Event for the detail.
To get the code of the key regardless of whether it was stored in
charCode, query the
Characters entered through an IME do not register through
charCode. Actually with the Chinese IME I'm using, entering the IME results in a keypress event with keyCode = 229 and no other key events fire until the IME exits (which may happen after multiple characters are inputted). I'm not sure if other IME's work this way.
For a list of the
charCode values associated with particular keys, run the example in Gecko DOM Reference:Examples #Example 7: Displaying Event Object Constants and view the resulting HTML table.
Not part of any specification.