Latest web development tutorials

HTML DOM removeChild method

Elements Object Reference Element object

Examples

Remove a node from the list of child nodes:

var list=document.getElementById("myList");
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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support removeChild method


grammar

node.removeChild(node)

parameter

参数 类型 描述
node 节点对象 必须。 你要移除的节点对象。

return value

类型 描述
节点对象 移除的节点

technical details

DOM version Core Level 1 Node Object


Elements Object Reference Element object