|
|
The HTML
onkeyup event attribute is used to execute a script or function when a user releases a key on the keyboard. This attribute can be applied to various HTML elements, commonly input fields and text areas, to enable dynamic responses to user input.
|
<input type="text" onkeyup="myFunction()">
The onkeyup attribute fires when the user releases a key (on the keyboard).
Tip: The order of events related to the onkeyup event:
<element onkeyup="script">
| Value | Description |
|---|---|
| script | The script to be run on onkeyup |
| Supported HTML tags: | All HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
|---|
A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.
<!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>
| html event attributes |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Keyboard Events Attribute |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference