Javascript examples for jQuery Method and Property:on
handle key event and check key code, the stop event bubble
<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>