【发布时间】:2014-03-30 11:43:56
【问题描述】:
删除注释行后,我的输出格式非常糟糕。
我想删除剩下的换行符。
HTML
<html>
<div class="donottouch">
</div>
</html>
我想变成这样
想要的输出
<html>
<div class="donottouch">
</div>
</html>
不输入其他div。
我用来删除注释行的代码:
$('> *', $content).contents().each(function() {
if (this.nodeType == 8) {
$(this).remove()
}
});
非常感谢您!
最好的问候,
亚历克斯
【问题讨论】:
-
你为什么要这样做?你真的没有得到/失去任何东西……
标签: jquery regex comments newline nodes