JQuery.highlightRegex Save

jQuery Plugin that lets you highlight document text with a regular expression.

Project README

⚠ Notice ⚠

I extracted this library from a project in 2009. It did everything I needed it to, and maybe it helped a few people. I no longer personally recommend building websites using the DOM as data like jQuery does. Newer alternatives to this library exist, although this still serves its intended function. This repo is partially maintained in that pull requests will be reviewed and bugs will be fixed, but I'm unlikely to add new behavior.

jQuery highlightRegex plugin

Want to highlight some text on a page with information you only know in javascript, maybe based on some dynamic input? Check out the highlight v3 by Johann Burkard. Need to be able to do the same thing but with a regular expression? You're at the right place.


Check out a simple demo here (source included in this repository).

Bower Installation

`bower install jquery-highlightRegex --save`



This would wrap all all vowels inside of #any.jquery.selector with a <span class='highlight'>.

To clear the highlighting, just call $('#any.jquery.selector').highlightRegex(); (with no argument).

If you'd like to wrap with a different sort tag and/or class, use

$('#jquery.selector').highlightRegex( /some ([rR]egex)/, {
  tagType:   'strong',
  className: 'andHale'

Additional attributes can be set on the created tag

$('#jquery.selector').highlightRegex( /some ([rR]egex)/, {
  attrs: {'data-color': 'blue'}
Open Source Agenda is not affiliated with "JQuery.highlightRegex" Project. README Source: jbr/jQuery.highlightRegex
Open Issues
Last Commit
5 years ago

Open Source Agenda Badge

Open Source Agenda Rating