<!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(){
$("input").css("background-color", "#FFFF99");
});
$("input").keyup(function(){
$("input").css("background-color", "pink");
});
$("#btn1").click(function(){
$("input").keydown();
});
$("#btn2").click(function(){
$("input").keyup();
});
});
</script>
</head>
<body>
<button id="btn1">keyDown trigger</button>
<button id="btn2">keyUp trigger</button>
<br /><br />
Name: <input type="text" name="name" />
</body>
</html>