js 如何删除某个div下的div元素
<divid="reducedLine"><divclass="reducedMiniBoxevenselectedType"name="mos">…</div><div...
<div id="reducedLine">
<div class="reducedMiniBox even selectedType" name="mos">…</div>
<div class="reducedMiniBox odd " name="df">…</div>
<div class="reducedMiniBox even " name="mlr">…</div>
<div class="reducedMiniBox odd " name="packetLossRatio">…</div>
<div class="reducedMiniBox even " name="mr">…</div>
<div class="reducedMiniBox odd " name="mlt15">…</div>
<div class="reducedMiniBox even " name="mlt24">…</div>
</div>
在js里如何删除掉<div class="reducedMiniBox even " name="mlt24">…</div>这个div
是隐藏掉。 展开
<div class="reducedMiniBox even selectedType" name="mos">…</div>
<div class="reducedMiniBox odd " name="df">…</div>
<div class="reducedMiniBox even " name="mlr">…</div>
<div class="reducedMiniBox odd " name="packetLossRatio">…</div>
<div class="reducedMiniBox even " name="mr">…</div>
<div class="reducedMiniBox odd " name="mlt15">…</div>
<div class="reducedMiniBox even " name="mlt24">…</div>
</div>
在js里如何删除掉<div class="reducedMiniBox even " name="mlt24">…</div>这个div
是隐藏掉。 展开
2个回答
展开全部
//js
var removeObj = document.getElementById('reducedLine').getElementsByName('mlt24')[0];
removeObj.parentNode.removeChild(removeObj);
//jquery
$('#reducedLine>div[name="mlt24"]').remove();
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询