Favorites

DOM Node.removeChild() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Node.removeChild()
DOM Node MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The removeChild() method removes a child node from its parent and returns it.

Description

The removeChild() method removes a child node from the parent and returns it. The removed node still exists in memory and can be inserted elsewhere. The simpler element.remove() removes an element without needing a reference to its parent.

If the node isn't a child of the parent you call it on, it throws a NotFoundError, so the common pattern was node.parentNode.removeChild(node), which remove() now replaces. Removing a node also removes all of its descendants. Event listeners stay attached to the removed node, so if you re-insert it, it keeps working.

Removing many children one at a time can be slow; to empty an element entirely, element.replaceChildren() with no arguments, or setting textContent to an empty string, removes all children in one step.

Syntax

parent.removeChild(child)

Parameters

  • childThe child node to remove.

Return Value

The removed node.

Exceptions

  • NotFoundErrorThrown if the node is not a child of the parent.

Example

<ul id="list">
  <li>One</li>
  <li>Two</li>
</ul>
const list = document.getElementById('list');
const removed = list.removeChild(list.firstElementChild);
console.log('Removed', removed.textContent, '- left:', list.children.length);
list.append(removed);

Browser Support

The following information will show you the current browser support for the Node.removeChild() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee