Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM removeChild method

HTML DOM removeChild() method

Element Object Reference Element object

Example

Remove a node from the list of child nodes:

var list=document.getElementById("myList");

list.removeChild(list.childNodes[0]);

Before removing:

After removing:

Try it »


Definition and Usage

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

If the removal succeeds, 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

Parameters 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 Reference Element object