HTML onkeyup Event Attribute

The HTML onkeyup event attribute is triggered when the user releases a key on the keyboard.


Following is the syntax −

<tagname onkeyup=”script”>Content</tagname>

Let us see an example of HTML onkeyup event Attribute −


 Live Demo

<!DOCTYPE html>
   body {
      color: #000;
      height: 100vh;
      background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat;
      text-align: center;
      padding: 20px;
   .show {
      font-size: 1.2rem;
<h1>HTML onkeyup Event Attribute Demo</h1>
<textarea class="" placeholder="Enter your message here" rows="5" cols="40" onkeyup="keyFn()"></textarea>
<div class="show"></div>
   function keyFn() {
      document.querySelector(".show").innerHTML = 'You enter: ' + document.querySelector("textarea").value;


Enter your message in white text area to observe how onkeyup event attribute works.