KeyboardEventcode Property
Description
Thecode property returns thekey code when a keyboard event occurs.
Thecode property is read-only.
Warning!
Thecode property returns different values for different keyboard layouts.
Use thekey property instead.
See Also:
Syntax
event.code
Technical Details
| Return Value: | A String, representing the key that was pressed |
|---|
Browser Support
event.code is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
| Chrome | Edge | Firefox | Safari | Opera |
| Yes | Yes | Yes | Yes | Yes |

