例如
html
<div nodeid="1_2">
<a id="d" href="index.html">知识</a>
</div>
<div nodeid="1_3">
</div>
<div nodeid="1_4">
</div>
<div nodeid="1_5">
</div>
<div nodeid="1_6">
js
var div = document.querySelector('div[nodeid="1_2"]');
var value = div.innerHTML.replace(/<.*?>/g,"\n");
var detachObj = null;
div.innerHTML = value;
console.log(value);
// div.parentNode.removeChild() //直接删除节点
detachObj1 = $("div[nodeid=\'1_2\']> a").detach(); //保留移除的数据和事件 ,允许以后重新插入