Get key value from a key pressed event - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:keypress

Description

Get key value from a key pressed event

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
  <script type="text/javascript" src="http://getfirebug.com/firebug-lite-debug.js"></script> 
  <script type="text/javascript">
    $(window).on('load', function() {
    $('textarea').keydown(function(e) {
        var order = e.which;/*from  ww  w.j  av  a  2s  .  c om*/
        console.log(order);
    });
    });

      </script> 
 </head> 
 <body> 
  <textarea></textarea>  
 </body>
</html>

Related Tutorials