/ Published in: jQuery
URL: http://www.techtricky.com/highlight-text-with-jquery/
Expand |
Embed | Plain Text
var template: '$1<span class="highlight">$2</span>$3'; var pattern = new RegExp('(>[^<.]*)(' + keywords + ')([^<.]*)', "ig"); var content = $('body').html(); $('body').html(content.replace(pattern, template));
You need to login to post a comment.
