CharacterData: appendData() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

appendData()CharacterData インターフェイスのメソッドで、指定されたデータをこのノードの現在のデータの末尾に追加します。

構文

js
appendData(data)

引数

data

現在のノードに追加するデータです。

返値

なし。

html
<span>結果: </span>テキスト
js
const span = document.querySelector("span");
const textnode = span.nextSibling;

textnode.appendData(" - 追加テキスト");

仕様書

Specification
DOM
# dom-characterdata-appenddata

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
appendData

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報