Home Tutorial Jquery 'key down' mouse event of the jQuery

 
 

'key down' mouse event of the jQuery
Posted on: August 9, 2010 at 12:00 AM
In this tutorial ,we will display ASCII value using "key down" method of jQuery.

'key down' mouse event of the jQuery

In this tutorial ,we will display ASCII value using "key down" method of jQuery. In this example , a text box is given. When you type something or press any key it shows ASCII value of that key.

keydown.html

<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.4.2.js"></script>
</head>
<body>

<input id="whichkey" value="type something">
<div id="log"></div>
<script>$('#whichkey').bind('keydown',function(e){
$('#log').html(e.type + ': ' + e.which );
}); </script>
</body>
</html>

OUTPUT

When we enter 'a' :

When we enter space bar it shows :

Download Source Code

Click here to see demo

Related Tags for 'key down' mouse event of the jQuery:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.