<!DOCTYPE html>
<html>
<head>
<title>jQuery keydown() and keyup() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$("input").keydown(function(){
$(this).css("background-color", "#FFFF99");
});
$("input").keyup(function(){
$(this).css("background-color", "pink");
});
});
</script>
</head>
<body>
<p>Enter some text on below textbox it will change background color base on keyDown and KeyUp.</p>
Name: <input type="text" name="name" />
</body>
</html>