<!doctype>
<html>
<head>
	<title>Detecting Key-Combo Events With jQuery</title>

	<script type="text/javascript" src="./jquery-1.7.1.js"></script>
	<script type="text/javascript">

		// Run when the DOM has loaded.
		$(function(){

			// Let's define a generic event handler that will look at
			// the key being pressed and log it out to the console.
			var keyHandler = function( event ){

				var keyCode = event.which;
				var keyChar = String.fromCharCode( keyCode );

				// Log the key captured in the event data.
				console.log(
					event.type + " : " + keyChar + " (" + keyCode + ")"
				);

			};

			// Now, let's try binding both the key-down and key-press
			// events to listen for the key and combos.
			$( "input" ).on( "keydown keypress", keyHandler );

		});

	</script>
</head>
<body>

	<h1>
		Detecting Key-Combo Events With jQuery
	</h1>

	<form>
		<input type="text" value="" size="30" />
	</form>

</body>
</html>