The code
property returns the key code when a keyboard event occurs.
The code
property is read-only.
The code
property returns different values for different keyboard layouts.
Use the key
property instead.
event.code
Return Value: | A String, representing the key that was pressed |
---|
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 |
event.code
is not supported in Internet Explorer 11 (or earlier).
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!