Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML onkeydown Event Attribute

HTML onkeydown Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Run a script when a key is pressed:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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:

  1. onkeydown
  2. onkeypress
  3. onkeyup

Note: The onkeydown attribute cannot be used with the following elements: , ,
, , ,