Horje
HTML onkeyup Attribute

Definition and Usage

The onkeyup attribute fires 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

Applies to

The onkeyup attribute is part of the Event Attributes, and can be used on any HTML elements.

Elements Event
All HTML elements onkeyup

Browser Support

 


How to Execute a JavaScript when a user releases a key - HTML onkeyup Attribute

A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<p>A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.</p>
Enter your name: <input type="text" id="fname" onkeyup="myFunction()">

<script>
function myFunction() {
  let x = document.getElementById("fname");
  x.value = x.value.toUpperCase();
}
</script>

</body>
</html>

Output should be:

How to Execute a JavaScript when a user releases a key - HTML onkeyup Attribute




html onkeyup attribute

Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference