CharacterData: remove() method - Web APIs | MDN

Syntax

Parameters

None.

Return value

None (undefined).

Example

Using remove()

html

<span>Result: </span>A long string.

js

const span = document.querySelector("span");
const textNode = span.nextSibling;

textNode.remove(); // Removes the text

Specifications

Specification
DOM
# ref-for-dom-childnode-remove①

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.