Bad Word Filter

Disallows specific words to be sent in a form textarea.

The Pen

I've set up my Pens so that the default view is Result. Once you've looked at the Result and decided that you want to use it somewhere, click the HTML, CSS or JavaScript tabs at the top of the Pen to view the code used.

The tabs are toggles, which means, to turn one off (or on) you just click the tab again.

HTML:

  • Copy and paste the HTML into the <BODY></BODY> of an HTML document

CSS:
  • Copy and paste the CSS into a <STYLE></STYLE> tag in the <HEAD></HEAD> section of the document. OR
  • Copy and paste the CSS into a CSS file and link to that file in the <HEAD></HEAD>.
JS:
  • Copy and paste the JavaScript into a <SCRIPT></SCRIPT> tag in the <HEAD></HEAD> section of the document. OR
  • Copy and paste the JavaScript into a JavaScript file and link to that file in the <HEAD></HEAD>.

Once you've done that, confirm that it all works, then edit it to your needs.

See the Pen Bad Word Filter by Matt Gibson (@mcfan) on CodePen.