jQuery Plugin For Replacing Unwanted Words - Blacklist.js

jQuery Plugin For Replacing Unwanted Words - Blacklist.js
File Size: 39.1KB
Views Total: 1170
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Blacklist.js is a small yet useful jQuery plugin for creating a blacklist of words on content to filter or replace unwanted words with your pre-defined characters.

How to use it:

1. Include jQuery javascript library and jQuery.Blacklist.js script on the web page

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="blacklist.js"></script>

2. Create a blacklist of words in javascript

<script type="text/javascript">
$(document).ready( function() {
$('p').blacklist(
{
  color: '#006699', // text color
  symbol: '****', // custom symbol
  ignore: ['ass', 'jap'], // array of unwanted words
  add_blacklist: ['Senthil'] // name of blacklist
});
});
</script>

3. The plugin will replace ass and jap words with **** in your document

<p>ass</p>
<p>wop</p>
<p>jap</p>
<p>Senthil</p>

This awesome jQuery plugin is developed by senthiljruby. For more Advanced Usages, please check the demo page or visit the official website.