handle key event and check key code, the stop event bubble - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:on

Description

handle key event and check key code, the stop event bubble

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from ww w  . j  av  a 2  s . c om
$('#texttype').on('keydown', function(e) {
    if ( e.which === 8 ) {
        return false;
    }
    e.stopPropagation();
});
    });

      </script> 
 </head> 
 <body> 
  <textarea id="texttype"></textarea>  
 </body>
</html>

Related Tutorials