My goal is to find a sentence in a html page and replace it / wrapping with
<span class='red'>...</span>
basically the same concept of highlighting results…but instead of words i need to highlight an entire sentence
for some reason my code sometimes works, sometimes not…
here:
$('body').each( function () {
$(this).html(function(i, html) {
return html.replace(myString, '<span class="red">'+myString+'<\/span>' );
});
});
also it seems to stop when it finds the first occurence of the first word of the sentence…
any help?
Be carefull there is no special caracter in your string (that could be iterpreted as a regexp operator)