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:
- Trigger a keypress/keydown/keyup event in JS/jQuery
- Vue.js v-on:keyup Directive
- jQuery | jQuery.fx.interval Property with example
- jQuery | jQuery.fx.off Property
- jQuery | jQuery.support Property
- jQuery | jquery Property
- jQuery | prepend() with Examples
- jQuery | dblclick() with Examples
- jQuery | offset() with Examples
- jQuery | children() with Examples
- jQuery | Hide/Show, Toggle and Fading methods with Examples
- jQuery | focusin() with Examples
- jQuery | Animation, Slide methods with Examples
- jQuery | change() with Examples
- jQuery | filter() with Examples
- jQuery | height() and innerHeight() with Examples
- jQuery | eq() with Examples
- jQuery | empty() with Examples
- jQuery | not() method with Examples
- jQuery | first() with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.