<!DOCTYPE html>
<html>
<head>
<title>jQuery keypress() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
i = 0;
$("input").keypress(function(){
$("span").text(i=i+1);
});
$("button").click(function(){
$("input").keypress();
});
});
</script>
</head>
<body>
<button>keypress trigger</button>
<br /><br />
Name: <input type="text" name="name" />
<br />
<p>No of key pressed: <span></span></p>
</body>
</html>