I have a function that wraps text with a span
$(".ui-content").html(function (i, v)
{
return v.replace(/(CANADA)/gi, '<span class="query">$1</span>');
});
However when I pass in the term "div"
or "span"
or "a"
which are html, the page gets messed up badly of course.
What can I change the regex
to remove only text that is not part of a html code like <strong>
but does work on A strong person is a helpful friend