CharacterData: remove() メソッド
remove() は CharacterData インターフェイスのメソッドで、このノードに含まれるテキストを削除します。
構文
js
remove()
引数
なし。
例
remove() の使用
html
<span>結果: </span>A long string.
js
const span = document.querySelector("span");
const textnode = span.nextSibling;
textnode.remove(); // Removes the text
仕様書
| Specification |
|---|
| DOM Standard # ref-for-dom-childnode-remove① |
ブラウザーの互換性
BCD tables only load in the browser