如何在javascript中替换html标签列表
var value1 = " <ul>
<li>Text1</li>
<li>Text1</li>
</ul> "
进入
value1 = " <br/> text1 <br/> text2 "
用正则表达式替换东西?
更新 :
我试试这个作品,但太长的脚本。
value1 = value1.replace(/<li>/g, "<p>");
value1 = value1.replace(/<\/li>/g, "</p>");
value1 = value1.replace(/<\/ul>/g, "</p>");
value1= value1.replace(/<ul>/g, "<p>");
value1 = value1.replace(/<\/ol>/g, "</p>");
value1 = value1.replace(/<ol>/g, "<p>");