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① |