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 Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 28/01/2021
3176 People Used
Only 97 Left
Rating
5.0