CharacterData: remove() method
The remove()
method of the CharacterData
removes the text contained in the node.
Syntax
js
remove()
Parameters
None.
Example
>Using <code>remove()</code>
html
<span>Result: </span>A long string.
js
const span = document.querySelector("span");
const textNode = span.nextSibling;
textNode.remove(); // Removes the text