HTML onkeyupEvent Attributes

HTML 事件属性HTML Event Attributes

Examples

Run a script when a key is released:

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

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onkeyup event attribute.


Definition and Usage

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

Tip:The order of events related to the onkeyup event:

  1. onkeydown
  2. onkeypress
  3. onkeyup

Note:The onkeyup attribute cannot be used on 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 Values

Value Description
script Specifies the script to be executed when the onkeyup event is triggered.


HTML 事件属性HTML Event Attributes Other Extensions