Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

jQuery keyup()

The jQuery keyup() event occurs when a keyboard button is released after pressing. This method is executed or attach a function to run when a keyup() event occurs.


  1. $(selector).keyup()

It triggers the keyup event for selected elements.

  1. $(selector).keyup(function)

It adds a function to the keyup event.

Parameters of jQuery keyup() event

Parameter Description
Function It is an optional parameter. It is executed itself when the keypress event is triggered.

Example of jQuery keyup() event

Let’s take an example to demonstrate jQuery keyup() event.

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src=“”></script>
  5. <script>
  6. $(document).ready(function(){
  7.     $(“input”).keydown(function(){
  8.         $(“input”).css(“background-color”, “red”);
  9.     });
  10.     $(“input”).keyup(function(){
  11.         $(“input”).css(“background-color”, “yellow”);
  12.     });
  13. });
  14. </script>
  15. </head>
  16. <body>
  17. Write something: <input type=“text”>
  18. </body>
  19. </html>

Test it Now


Write something:

Note: If you write something in the above text box then the background color will be changed on keydown and keyup.