The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
which property
Gets the numeric code of a key that is pressed.
![]() |
Syntax
| JavaScript | |
|---|
Property values
Type: Integer
The key code.
Standards information
There are no standards that apply here.
Remarks
The which property is provided for compatibility only. The keyCode property is more widely supported; however, we recommend the key property for international keyboard layouts and improved accessibility.
See also
- KeyboardEvent
- Reference
- char
- charCode
- key
- keyCode
Show:
