Easy Tutorial
❮ Att Input Step Att A Shape ❯

HTML onkeydown Event Attribute

HTML Event Attributes

Example

Run a script when a key is pressed:


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 sequence of event triggers related to the onkeydown event:

Note: The onkeydown attribute cannot be used with the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.


Differences Between HTML 4.01 and HTML5

None.


Syntax

Attribute Values

Value Description
script Specifies the script to run when the onkeydown event is triggered.

❮ Att Input Step Att A Shape ❯