Remove html tags except
or
tags with javascript

后端 未结 5 1996
渐次进展
渐次进展 2020-12-03 03:09

I want to remove all the html tags except
or
tags from a string using javascript. I have seen many questions like this but t

5条回答
  •  情书的邮戳
    2020-12-03 04:04

    Try This

     function remove_tags(html)
     {
       var html = html.replace("
    ","||br||"); var tmp = document.createElement("DIV"); tmp.innerHTML = html; html = tmp.textContent||tmp.innerText; return html.replace("||br||","
    "); }

提交回复
热议问题