I really thought this would have been answered years ago, still I did not find any solution:
I want to highlight (i.e. make a colored background) all occurrences of
If you are trying to highlight the search terms from google then you can use this jquery plugin available at https://github.com/hail2u/jquery.highlight-search-terms
If you want functionality like chrome. you can use this code.
$(document).ready(function(){
var search = ['p', 'div', 'span'];
$("#highlighter").bind('keyup', function(e){
var pattern = $(this).val();
$.each(search, function(i){
var str = search[i];
var orgText = $(str).text();
orgText = orgText.replace(pattern, function($1){
return "" + $1 + ""
});
$(str).html(orgText);
});
});
});