<body>
<div id='div1'>xxxxx</div>
<div id='div2'>xxxxx</div>
<div id='div3'>xxxxx</div>
xxxxxxxx
</body>
怎样用jquery或js删除div3与标签</body>之间的内容,想要的结果如下:<body>
<div id='div1'>xxxxx</div>
<div id='div2'>xxxxx</div>
<div id='div3'>xxxxx</div>
</body>
解决方案 »
- js判断过后保留控件内容
- 如何实现不受滚动影响的图层或表格呢?
- 为什么formpanel不能显示3行?
- 奇怪的JS跟随层问题
- 如何得知同名的select是一个还是多个?
- 谁能解决?????世界上最难的问题!!!!!!急等解决!! 分值 750分 750分 750分 750分 750分
- 这个问题怎么解决?up有分
- 如何获取页面元素颜色的RGB值?
- zilong:当表单中有一个Text框时,在框里输入回车,表单会发送,旧帖子的方法不行,各位有没有可行的例子,重分达谢
- js怎么让页面中所有控件ID开头一样全部隐藏
- (虚心请教)我想做成淘宝首页的广告导航栏
- Jquery给元素同时绑定多个事件后产生的问题
document.body.removeChild(document.body.lastChild);
}
return this.nodeType == 3;
}).last().remove();
其次你们的方法只是删除文本吗?
如果xxxxx中也有标签怎么办,比如div什么的。我的原始需求是这样的:<div id="footerWrap"></div>
xxxx
<div id="videoSourceList" class="hid" style="display: none; width: auto; min-height: 0px; height: 470.867px;" scrolltop="0" scrollleft="0">
<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display: none; z-index: 1010; outline: 0px none; position: absolute; height: auto; width: 900px; top: 0px; left: 0px;" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-textSourceList">
<div id="audioSourceList" class="hid" style="display: none; width: auto; min-height: 0px; height: 470.867px;" scrolltop="0" scrollleft="0">
<div id="imageSourceList" class="hid" style="display: none; width: auto; min-height: 0px; height: 470.867px;" scrolltop="0" scrollleft="0"></body>删除中间的文本和div,最终要的结果:<div id="footerWrap"></div>
</body>
while (document.body.lastChild.nodeType === 3) {
document.body.removeChild(document.body.lastChild);
}