HTML DOM KeyboardEvent
❮ DOM Events
❮ Event Objects
The KeyboardEvent Object
The KeyboardEvent Object handles events that occur when a user presses a key on the keyboard.
Keyboard Events
KeyboardEvent Properties
Property |
Returns |
altKey |
If the ALT key was pressed |
charCode |
Deprecated (Avoid using it) |
code |
The code of the key that triggered the event |
ctrlKey |
If the CTRL key was pressed |
isComposing |
If the state of the event is composing or not |
key |
The value of the key that triggered the event |
keyCode |
Deprecated (Avoid using it) |
location |
The location of a key on the keyboard or device |
metaKey |
If the META key was pressed |
repeat |
If a key is being hold down repeatedly, or not |
shiftKey |
If the SHIFT key was pressed |
which |
Deprecated (Avoid using it) |
KeyboardEvent Methods
Inherited Properties and Methods
The KeyboardEvent inherits all the properties and methods from:
The UiEvent
The Event Object
❮ DOM Events
❮ Event Objects
W3schools Pathfinder
Track your progress - it's free!