Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (13 sloc) 721 Bytes

jQuery highlightText

Simple Text Highlighting via Unobtrusive JavaScript

The jQuery Text Highlight Plugin can be used if you want to highlight query words in the User Interface.

Methods

  • highlightText(text, options): returns each element which contains a text node that matches text

Supported properties

The highlightText function accepts the following options:

  • cssClass: the CSS class name to be added to the span that acts like a container for the matched text (defaults to mark)
  • ignoreCase: turn on/off case-insensitive mode (defaults to true)

Example use

Check out the demo.html page.

Copyright

Copyright © 2013 Kjel Delaey, released under the MIT license.