<!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);
});
});
</script>
</head>
<body>
Name: <input type="text" name="name" />
<br />
<p>No of key pressed: <span></span></p>
</body>
</html>