Web Development Course:
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
keyupas the event parameter.
Usage and Syntax of .keyup()
.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:
Follow this syntax to indicate a function to be run when the event is invoked:
Note: to detect text entry, .keypress() method is preferred.