I use the jQuery html Attributes to wrap some words in a large piece of text, this works fine but if the text has some html tags in it, it will remove all tags. Is there a way to prevent this with the html Attributes, preventing that i strips the other tags?
piece of the code
var pattern = new RegExp('('+$.unique(text.replace(/\./g, '\\.').split(" ")).join("|")+")","gi");
jQuery('searchin').each(function(i){
var orgText = jQuery(this).text();
orgText = orgText.replace(pattern, function($1){
return '<b class="highlight">' + $1 + '</b>';
});
jQuery(this).html(orgText);
text? Is it of the form"my list of space-separated words"?