HTML DOM removeChild()Method

元素对象参考手册Element Object

Examples

Remove a node from the child node list:

var list=document.getElementById("myList");
list.removeChild(list.childNodes[0]);

Before removal:

  • Coffee
  • Tea
  • Milk

After removal:

  • Tea
  • Milk

Try it Yourself »

Definition and Usage

The removeChild() method removes a specified node from the child node list.

If the removal is successful, this method returns the removed node; if it fails, it returns NULL.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the removeChild method


Syntax

node.removeChild(node)

Parameters

Parameter Type Description
node Node Object Required. The node object you want to remove.

Return Value

Type Description
Node Object The removed node

Technical Details

DOM Version Core Level 1 Node Object


元素对象参考手册Element Object

Other Extensions