KeyboardEvent code property
Definition and usage
The code property returns the key that triggered the event.
Note:This property returns different values for different keyboard layouts.
Tip:To ensure the correct character is returned, please use event.key.
Syntax
event.code
Technical details
Return value: | String value representing the key pressed. |
---|
Browser support
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
code | 48 | Not Supported | 32 | 10 | Support |
Related Pages
HTML DOM Reference Manual:KeyboardEvent key Attribute
HTML DOM Reference Manual:KeyboardEvent charCode Attribute
HTML DOM Reference Manual:KeyboardEvent keyCode Attribute