Search w3schools.com:

SHARE THIS PAGE

DOM Node removeChild() Method

Node Object Reference Node Object

Example

Remove an item from a list:

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

Before removing:

  • Coffee
  • Tea
  • Milk

After removing:

  • Tea
  • Milk

Try it yourself »

Definition and Usage

The removeChild() method removes a specified child node of the specified element.

Returns the removed node as a Node object, or null if the node does not exist.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The removeChild() method is supported in all major browsers.


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 Reference Node Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]