Advertisement
Home Open Editor ❯

HTML onkeydown Attribute

Example

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

Try this code ❯

Meaning

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

Related Keyboard Events


Standard Syntax

<element onkeydown="script">


Applies to:

The onkeydown attribute can be used on the following element:

Element Attribute
All HTML elements. onkeydown

Advertisement

Attribute Values

Value Description
script Specifies the script to be run on onkeydown
Home Open Editor ❯
Advertisement