JavaScript中刪除子節點的方法有以下幾種:
var parent = document.getElementById("parent");
var child = document.getElementById("child");
parent.removeChild(child);
var child = document.getElementById("child");
child.remove();
var parent = document.getElementById("parent");
parent.innerHTML = "";
var parent = document.getElementById("parent");
while (parent.firstChild) {
parent.removeChild(parent.firstChild);
}