removeChild()
从DOM树上移除一个元素
removeChild
<div id="parent">
<!-- <p>hello world</p> -->
<div id="good">good</div>
</div>
<script>
var parent = document.getElementById("parent")
var good = document.getElementById("good");
var p =document.createElement("p");
p.innerHTML = "hello world"
/*
appendChild()
给元素增加节点
*/
parent.appendChild(p);
parent.removeChild(good);
</script>
![image.png](https://cdn.nlark.com/yuque/0/2019/png/446381/1568119331646-d283a74a-ba7e-4912-b145-42e340bf26bb.png#align=left&display=inline&height=365&name=image.png&originHeight=365&originWidth=242&size=15325&status=done&width=242)