Utilize a função abaixo para substituir tags html com javascript Puro
Abaixo um código simples com Javascript Puro de como alterar tags html com a Função Regexp
/**
* Substitui uma tag html por outra tag
* ex: replaceTag('<span>teste</span>','span','b');
* "<span>teste</span>".replace(/(<\/?)(\w+?)(>)/g,"$1b$3")
*/
function replaceTag(html, oldtag, newtag){
var re = new RegExp('(<\\/?)('+oldtag+')(>)','g');
return html.replace(re, "$1"+newtag+"$3");
}
