jQuery | keyup() with Examples
The keyup() is an inbuilt method in jQuery which is used to trigger the keyup event whenever User releases a key from the keyboard. So, Using keyup() method we can detect if any key is released from the keyboard.
Here selector is the selected element.
Parameters: It accepts an optional parameter as a function which gives the idea whether any key is pressed or not.
Return values: It returns whether any key is pressed or not and accordingly change the background color.
Below code is used to check if a keyboard key is released after being pressed.
After running the code:
After pressing any key from the keyboard-
Below code is used to change background color of the page whenever a key is released from the keyboard
Before pressing a key:
Every time When any key is pressed and released from the keyboard, The background colour of the page changes to a new colour-
After pressing and releasing any key: