keyCode property

int get keyCode

The deprecated KeyboardEvent.keyCode read-only property represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.

This is usually the decimal ASCII (20) or Windows 1252 code corresponding to the key. If the key can't be identified, this value is 0.

You should avoid using this if possible; it's been deprecated for some time. Instead, you should use KeyboardEvent.code (for the physical key pressed) or KeyboardEvent.key (for the character the key maps to). Check compatibility for either property if you target very old browsers.

Note: Web developers shouldn't use the keyCode attribute for printable characters when handling keydown and keyup events. As described above, the keyCode attribute is not useful for printable characters, especially those input with the Shift or Alt key pressed.

Implementation

external int get keyCode;