Highlight – Simple text phrase highlighter jQuery plugin
Highlight is a simple Jquery plugin that highlights text phrases. It has been executed in this post to highlight ‘acknowledgment’, ‘matching’ and ‘class name’.
Highlight is a simple Jquery plugin that highlights text phrases. It does so by wrapping one or multiple phrases with a span with the class name “highlight”.
How to use Highlight
You can throw both a string or an array on Highlight. Have a look at the example below. The first row is going to highlight the word acknowledgment, the second row is going to highlight both ‘matching’ and ‘class name’. The code shown in the example below has been executed in this page.
$('.body').highlight("acknowledgment");
$('.body').highlight(["matching","class name"]);
What actually happens is that the matching phrases are wrapped inside a span element with the class name highlight. Therefor you will also need to add some css code to get a visual result.
.highlight { background: #ff0; }
| Keyword | Changes |
|---|---|
| Partiall links | Highlight phrases partially inside an a element (link), In the current version; If a phrase is partially inside a html elemente it will not be highligted. |
Acknowledgment
Johann Burkard The core is based on ideas presented in Johann Burkard’s Jquery plugin with the same name.
Comments
Make a comment
Projects
- Accordion (jQuery)
- Airport (jQuery)
- Defaultvalue (jQuery)
- Elastic (jQuery)
- Highlight (jQuery)
- Keycan
- Lazy (jQuery)
- Limit (jQuery)
- Password Strength (jQuery)
- Show Password (jQuery)
- Tabify (jQuery)
- Valid8 (jQuery)
Latest posts
- July 8th, 2009 Why are we typing passwords twice?
- July 5th, 2009 Don’t stop password masking; let the user decide
- June 1st, 2009 You can’t validate email addresses with regular expressions
- May 20th, 2009 Konami Code: Why so verbose, when you can make it in 140 characters?
- May 18th, 2009 Let your users know if Firebug slows down your web page.
Thanks!.. I found this most useful and will be using it in one of my production sites..
Cheers!
I like it. Thanks!
How do we highlight the words that match the words searched by the user in the previous page (search engine)?
Great site! Congratulations!
[...] Highlight – jQuery Plugin [...]
it will be really helpful if you can post the source
Thanks in advance
Test : Acknowledgment
Very good job ! Than you.
1980 clathrate century new link until
Good Article, thx