X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM removeChild() Method

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


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook