Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

Real Time Text Input or Textarea Filter Tutorial

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>
thumb

JavaScript Videos

Form Programming

Contact Form Web Application Tutorial Ajax HTML5 PHPCheckbox Toggle Tutorial Select Deselect All ElementsIn Place Editing CMS Development HTML JavaScript TutorialCustom Progress Bar Meter Development For File Upload FormsMultiphase Form Programming Tutorial Multi StepRestrict Text Input Characters HTML JavaScript TutorialMonthly Payment Loan Calculator Form Programming TutorialDynamic Select Year List Script HTML Form ElementsTip Calculator Application Form Programming Tutorialtextarea Form Field Character Counting and LimitingBuilding a WYSIWYG Rich Text Editor Textarea Replacement Part 1Building a WYSIWYG Rich Text Editor Textarea Replacement Part 2Div contenteditable Click Select All Text execCommand selectAllToggle Password Security Form Input Characters TutorialTrap User Check for Unsaved Written Work TutorialReal Time Text Input or Textarea Filter TutorialForm Select Change Dynamic List Option Elements Tutorial