Loading ...

How to find which key was pressed | CodeAsp.Net

How to find which key was pressed

0 (0votes)

In this blog I will explain how to find which key was pressed with jQuery.I have used one textbox to explain that .On pressing any key an alert window will open and displays the key code of that key which was pressed. Below is the code:

<html xmlns="http://www.w3.org/1999/xhtml">



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>




<input id="TestTextBox" type="text" />



<script type="text/javascript">





var code = null;

code = (e.keyCode ? e.keyCode : e.which);

alert('Key Code:' + code);








Happy Reading!


Comments (no comments yet)

Top Posts