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 withkeyupas 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.