When removing an element with standard JavaScript, you must go to its parent first: 使用標準JavaScript刪除元素時,必須首先轉到其父元素: node
var element = document.getElementById("element-id"); element.parentNode.removeChild(element);
Having to go to the parent node first seems a bit odd to me, is there a reason JavaScript works like this? 首先必須去父節點對我來講有點奇怪,JavaScript是否有這樣的緣由? 服務器