var ori = '<span>test</span><span>test2</span>', newstr = '';
newstr = ori.replace(/\<span\>/g,'<span class="pretty">');
Javascript中使用replace的正则表达式替换字符串里全部指定HTML标签
最新推荐文章于 2021-09-23 10:29:23 发布
var ori = '<span>test</span><span>test2</span>', newstr = '';
newstr = ori.replace(/\<span\>/g,'<span class="pretty">');