I think you are looking for a jQuery highlight plugin .
Once you download it, you can just do something like this:
var words = "hello,thanks, goodbye";
var keywords = words.split(',');
for(var x = 0; x < keywords.length; x++) {
$(selector).highlight($.trim(keywords[x]));
}
Where selectoris what element in the document you want to find. If you want this done on the whole page, just put it 'body'.
source
share