Javascript examples for DOM HTML Element:Textarea
Handle textarea key pressed event
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> var arrForbiddenCodes = [97, 98, 99]; function CheckKey(event) {//from w w w . j a v a2 s . c o m var keyCode = event.keyCode || event.which; for (var i = 0; i < arrForbiddenCodes.length; i++) { if (arrForbiddenCodes[i] === keyCode) return false; } return true; } </script> </head> <body> <textarea onkeypress="return CheckKey(event);"></textarea> </body> </html>