How To Capture Keyboard Events Using JQuery

In this article I will discuss how to capture keyboard events using Jquery. This will help us to know the values of each keystroke in the keyboard. Just follow the simple steps to write Jquery function.

Steps to follow:

1.  In HTML page add the following JS file in between head tags(<head></head>)

<script type="text/javascript" src=""></script>

2. After this add the following Javascript function next to that reference file.

<script type="text/javascript" src=""></script>
script type="text/javascript" language="javascript">
$(document).ready(function () {
$(document).live('keydown', function (e) {
alert('The key value is : ' + e.which);


3. Then Run your HTML page in browser and hit “ENTER” key you will get the result.



Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now