Firefox Tomorrow

web api instance method

CharacterData: remove() method

View on MDN ↗

The remove() method of the CharacterData removes it from its parent node. If it has no parent node, calling remove() does nothing.

Syntax

remove()

Parameters

None.

Return value

None (undefined).

Example

Using remove()

<span>Result: </span>A long string.
const span = document.querySelector("span");
const textNode = span.nextSibling;

textNode.remove(); // Removes the text
Interactive exampleOpen the canonical MDN source to run this embedded demo.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also