HTML onkeyup event attribute

Example

When the user releases the key, execute a JavaScript script:

<input type="text"> onkeyup="displayResult()">

Try It Yourself

Browser Support

IE Firefox Chrome Safari Opera

All major browsers support the onkeyup attribute.

Definition and Usage

The onkeyup attribute triggers when the user (on the keyboard) releases a key.

Tip:Event order relative to onkeyup event:

  • onkeydown
  • onkeypress
  • onkeyup

Note:The onkeyup attribute is not applicable to the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> or <title>.

Differences between HTML 4.01 and HTML5

None.

Syntax

<element onkeyup="script">

Attribute Value

Value Description
script Script that runs when onkeyup occurs.