Word & Character Highlighter In jQuery - TUS.Marker
File Size: | 6.5 KB |
---|---|
Views Total: | 748 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
TUS.Marker is an easy and fast jQuery text highlighting plugin for highlighting words in paragraphs or characters in strings.
How to use it:
1. Include the jquery.textmarker.js
after jQuery.
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/jquery.tusmarker.js"></script>
2. Highlight words in paragraphs and apply a custom CSS class to the matched words.
$('#content').tusmarker({
text: "anyWord", css: "highlight", });
3. Then you can apply custom styles to the words.
.highlight { font-weight: bold; color:#fff; background: #4F46E5; padding: 2px; border-radius: 2px; }
4. Highlight words that includes specific characters instead.
$('#content').tusmarker({
text: "anyCharacter", css: "highlight", inWord: true, });
5. Determine whether uppercase and lowercase letters are treated as distinct (case-sensitive) or equivalent (case-insensitive). Default: true.
$('#content').tusmarker({
text: "anyCharacter", css: "highlight", inWord: true, caseSensitive: false, });
This awesome jQuery plugin is developed by uekichinos. For more Advanced Usages, please check the demo page or visit the official website.