🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

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.