Attach a function to the keyup event: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:keyup

Description

Attach a function to the keyup event:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input").keydown(function(){
        $("input").css("background-color", "yellow");
    });/*w ww .  ja  v a2 s. com*/
    $("input").keyup(function(){
        $("input").css("background-color", "pink");
    });
});
</script>
</head>
<body>

Enter your name: <input type="text">

<p>Enter your name in the input field above.</p>

</body>
</html>

Related Tutorials