Keydown listener for body - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:keydown

Description

Keydown listener for body

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-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from   w ww .j  ava2  s.  c  om*/
$('input').keydown(function(e){
    e.stopPropagation();
});
$(document).keydown(function(e){
    if (e.keyCode==32) {
     stopplay();
    }
});
    });

      </script> 
   </head> 
   <body> 
      <input>  
   </body>
</html>

Related Tutorials