Using Regex to allow disallow text in textarea - Javascript jQuery

Javascript examples for jQuery:Form Textarea

Description

Using Regex to allow disallow text in textarea

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">
    $(window).on('load', function() {
$('#textbox').keyup(function (e) {
    this.value = this.value.replace(/[^a-z0-9]/ig, '');
});//  w  w  w .ja  v a 2s  . c  o  m
    });

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

Related Tutorials