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

HTMLWeb DevelopmentFront End Technology

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

Example

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

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

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

      <script>
         function display() {
            alert("You released a key!");
         }
      </script>
   </body>
</html>
raja
Published on 13-Mar-2018 17:13:06
Advertisements