We would like to know how to track key code.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<!--from w w w . j ava2 s.c o m-->
</head>
<body>
<div>Click here!!!</div>
<script type='text/javascript'>
var myArr = [];
document.addEventListener('keypress', function(e) {
var newContent = myArr.push(e.keyCode);
console.log(myArr);
});
</script>
</body>
</html>
The code above is rendered as follows: