Execute a script when a user releases a key in HTML?

Use the onkeyup attribute. The onkeyup attribute triggers when the user releases a key.


You can try to run the following code to execute a script on releasing a key −

<!DOCTYPE html>
      <p>Press a key inside the textbox.</p>

      <input type = "text" onkeydown = "display()">

         function display() {
            alert("You released a key!");