key event type and key code


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="http://code.jquery.com/jquery-git.js"></script>
  5. </head>
  6. <body>
  7.  
  8. <input id="whichkey" value="type something">
  9. <div id="log"></div>
  10. <script>$('#whichkey').bind('keydown',function(e){
  11. $('#log').html(e.type + ': ' + e.which );
  12. }); </script>
  13.  
  14. </body>
  15. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.