jQuery keyup() Method
jQuery keyup() method trigger the keyup event. The jQuery keyup event occurs when a keyboard key is released up. And when the keyup event occurs, specified function will execute.
Syntax
This triggers the keyup event on the selected elements.
$(selector).keyup(); // This syntax does not accept any arguments.
Attach a function to the keyup event.
$(selector).keyup(function);
Parameter | Type | Description |
---|---|---|
function | Function | Optional. Specifies the function to execute when the keyup event is occurs. |
Examples
This example represents the keyup() event.
$(document).ready(function(){
$("input").keydown(function(){
$("input").css("background-color", "#FFFF99");
});
$("input").keyup(function(){
$("input").css("background-color", "pink");
});
$("#btn1").click(function(){
$("input").keydown();
});
$("#btn2").click(function(){
$("input").keyup();
});
});
This example represent to attach a function to the keyup() event.
$(document).ready(function(){
$("input").keydown(function(){
$(this).css("background-color", "#FFFF99");
});
$("input").keyup(function(){
$(this).css("background-color", "pink");
});
});