HTML onkeydown Attribute

❮ HTML Attributes

Example

<input type="text" onkeydown="myFunction()">

Meaning

The onkeydown attribute specifies the script run when a user is pressing a key.

Related Keyboard Events




Standard Syntax

<element onkeydown="script">



Browser Support




Status




Applies to:

The onkeydown attribute can be used on the following element:

Element Attribute
All HTML elements. onkeydown






Attribute Values

Value Description
script Specifies the script to be run on onkeydown
❮ HTML Attributes