HTML onkeydown Event Attribute
Example
Run a script when a key is pressed:
Try it »
Browser support





All major browsers support the onkeydown event attribute
Definition and Usage
The onkeydown attribute is triggered when the user presses a key (on the keyboard).
Tip: The event firing order related to the onkeydown event:
- onkeydown
- onkeypress
- onkeyup
Note: The onkeydown attribute cannot be used with the following elements:
, , ,
HTML Event Attributes