Block Specific Bad Words Using JavaScript jQuery

In this tutorial i am going to explain about How to Block Specific(Bad) Words Using JavaScript/jQuery. In my previous tutorial i have explained about Increse Decrease Font Size | Zoom In Zoom Out Text Size Using jQuery , jQuery Code/Script To Make The First Word BoldHow To Show Tooltip On Mouse Hover In Gridview in Using jQuery in ASP.Net C#.Net & VB.NetHow To Convert JSON Data Into Html Table Using Javascript jQueryShow hide password characters using javascript,jquery and Toggle Checkbox Checked Property Using jQuery

Implementation :

Now we will see the implementation of How to Block Specific(Bad) Words Using JavaScript/jQuery. In a web based application where we have some anonymous forms, users may type unwanted words in the free text. So in this tutorial i will explain you how to restrict specific words in the freetext using javascript & jQuery.
First create a html page.

In that page add a freetext textbox and a button. On button click call a javascript function which i defined in the script fnCheckForRestrictedWords(). Within this function i have added an string array of words which i would like to block in the textbox. So while clicking on the button it will pass the textbox value to the function and check any restricted words in the array isexists in the text box. If exists then it will through an error message saying that “You have entered some restricted words”. Else it won’t through any error.

Below is the html and script used for demo purpose.



Now if you run the program you can see the output of How to Block Specific(Bad) Words Using JavaScript/jQuery.

Block Spcific(Bad) Words Using JavaScript/jQuery


Hope you learned  How to Block Specific(Bad) Words Using JavaScript/jQuery. Do you like this tutorial? Help us to improve. Please post your comments and feedback below.

Search Terms:

bad word filter jquery,bad words filter javascript,bad word filter ,bad word checker,javascript profanity check, javascript bad words

Leave a Reply

Your email address will not be published. Required fields are marked *