jQuery Plugin To Replace Any Text Within Document ReplaceMe - Download jQuery Plugin To Replace Any Text Within Document - ReplaceMe

Download jQuery Plugin To Replace Any Text Within Document – ReplaceMe

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Replace Any Text Within Document – ReplaceMe, hope it will help you in programming stack.

jQuery Plugin To Replace Any Text Within Document ReplaceMe - Download jQuery Plugin To Replace Any Text Within Document - ReplaceMe
File Size: 11.9 KB
Views Total: 352
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

ReplaceMe is an ultra-lightweight jQuery plugin used to replace any text with other text or html in your html document.

How to use it:

1. Load jQuery library and the jQuery ReplaceMe plugin at the end of the document.

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="jQueryReplaceMe.js"></script>

2. Call the function on target container to replace text aliquet with <span class="label label-default">Other Text</span>

1 $('.container').replaceMe({
2   textToReplace: 'aliquet',
3   replaceWithText: '<span class="label label-default">Other Text</span>',
4 });

3. Set the globally to false to only replace the first matched text.

1 $('.container').replaceMe({
2   textToReplace: 'aliquet',
3   replaceWithText: '<span class="label label-default">Other Text</span>',
4   globally: false
5 });

4. Set excluded HTML tags which should be ignored.

1 $('.container').replaceMe({
2   textToReplace: 'aliquet',
3   replaceWithText: '<span class="label label-default">Other Text</span>',
4   globally: false,
5   excludedTags: [
6     'img',
7     'span'
8   ]
9 });

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

source : jqueryscript.net