Code has been added to clipboard!

jQuery .keyup(): Apply Functions for When Keys Are Released

Reading time 1 min
Published Jul 3, 2019
Updated Sep 27, 2019

jQuery keyup: Main Tips

  • The jQuery .keyup() attaches an event handler for when the key is released, or triggers the keyup event.
  • .keyup() function is a shorthand for onkeyup jQuery: the .on() function with keyup as the event parameter.

Usage and Syntax of .keyup()

The jQuery .keyup() method adds an event handler for the keyup event, or invokes the event. The keyup event occurs when a key on the keyboard is released. In the event below, the color of the input field changes as soon as you release the button after typing into it:

To simply trigger the keyup event, use this syntax:

$("selector").keyup();

Follow this syntax to indicate a function to be run when the event is invoked:

$("selector").keyup(function)

Note: to detect text entry, .keypress() method is preferred.

Latest Coupon Found:

Verified STAFF PICK

TOP-RATED CODING COURSES

Learn the skills of tomorrow

The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!

Expiration date: 13/05/2021
2287 People Used
Only 92 Left
Rating
5.0