English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag List

HTML onkeyup Event Attribute

The onkeyup attribute is used to get or set the event handler function for the keyup event of the current element

HTML Event Attributes

Online Example

Execute JavaScript when the user releases the key:

<!DOCTYPE html>
<html>
<head>
<title>Usage of HTML onkeyup Event Attribute (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
<p>The function is triggered when the user releases the key in the input field. The function converts the characters to uppercase.</p>
Enter English name: <input type="text" id="fname" onkeyup="myFunction()">
<script>
function myFunction() {
  var x = document.getElementById("fname");
  x.value = x.value.toUpperCase();
}
</script>
</body>
</html>
Test See ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the onkeyup event attribute

Definition and Usage

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

Tip: Trigger order of events related to onkeyup:

  • onkeydown

  • onkeypress

  • onkeyup

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

HTML 4.01 With HTML5Differences

None.

Syntax

<element onkeyup="script">

Attribute Value

ValueDescription
scriptSpecifies the script to be executed when the onkeyup event is triggered.


HTML Event Attributes