HTML DOM removeChild method
Examples
Remove a node from the list of child nodes:
var list=document.getElementById("myList");
list.removeChild(list.childNodes[0]);
list.removeChild(list.childNodes[0]);
Remove the front:
- Coffee
- Tea
- Milk
After removal:
- Tea
- Milk
try it"
Definition and Usage
removeChild () method to remove a node from the list of child nodes.
Such as the deletion is successful, this method returns the removed node, such as fails, it returns NULL.
Browser Support
All major browsers support removeChild method
grammar
node.removeChild(node)
parameter
参数 | 类型 | 描述 |
---|---|---|
node | 节点对象 | 必须。 你要移除的节点对象。 |
return value
类型 | 描述 |
---|---|
节点对象 | 移除的节点 |
technical details
DOM version | Core Level 1 Node Object |
---|