Share on Google+Share on Google+

'key down' mouse event of the jQuery

Advertisement
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

Advertisements

Posted on: August 9, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.