Skip to content
Related Articles

Related Articles

HTML | DOM onkeyup Event

Improve Article
Save Article
  • Last Updated : 25 Jul, 2019
Improve Article
Save Article

The DOM onkeyup event in HTML occurs when a key is released after pressing by the user.

Order of events related to the onkeyup event:

  • onkeydown
  • onkeypress
  • onkeyup

Supported HTML tags: All HTML elements, EXCEPT:

  • <base>
  • <bdo>
  • <br>
  • <head>
  • <html>
  • <iframe>
  • <meta>
  • <param>
  • <script>
  • <style>
  • <title>


  • In HTML:
    <element onkeyup="myScript">
  • In JavaScript:
    object.onkeyup = function(){myScript};
  • In JavaScript, using the addEventListener() method:
    object.addEventListener("keyup", myScript);

Example: onkeyup Event using the addEventListener() method

<!DOCTYPE html>
      HTML DOM onkeyup Event
        <h1 style="color:green">
          Press any key inside the input field
        <input type="text" 
              "keyup", GFGFun);
            function GFGFun() {
                  "inputField").style.backgroundColor = 



Supported Browsers: The browsers supported by HTML DOM onkeyup Event are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!