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 property
HTML DOM reference manual:KeyboardEvent charCode property
HTML DOM reference manual:KeyboardEvent keyCode property