FULL STACK   ·   UI   ·   UX   ·   GRAPHICS   ·   DEVELOPER   ·   INSTRUCTOR

Adam Khoury

Donate funds to show love and support

Click the button below to donate funds securely online. You can use your PayPal account or a credit card.

Your donations help free up my time to produce more content and assist in covering server costs. It's also a great way to say thanks for the content!

Application Configuration

Adam will be adding options here soon.

Real Time Text Input or Textarea Filter Tutorial

Published :
Author :
Adam Khoury
In this JavaScript programming lesson you can learn Real-Time Filtering of Text Input. You can learn how to program real time strict text fields that will strip or replace unwanted characters from the field as the user types. Using the search, strip, or replace String object methods in JavaScript along with the RegExp object gives us a wide of logic possibilities in our JavaScript pattern matching with regular expressions. <script> function clean(el){ var textfield = document.getElementById(el); var regex = /[^a-z 0-9?!.,]/gi; if(textfield.value.search(regex) > -1) { textfield.value = textfield.value.replace(regex, ""); } } </script> <textarea id="ta" name="ta" onkeyup="clean('ta')" onkeydown="clean('ta')"></textarea>