Range: selectNode() メソッド

Baseline Widely available

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

The Range.selectNode() メソッドは RangeNode とその内容を格納するように設定します。 Range の始めと終わりの親 NodereferenceNode の親と同じになります。

構文

js
selectNode(referenceNode)

引数

referenceNode

Range の中にある選択する Node です。

返値

なし (undefined)。

js
let range = document.createRange();
let referenceNode = document.getElementsByTagName("div").item(0);

range.selectNode(referenceNode);

仕様書

Specification
DOM
# dom-range-selectnode

ブラウザーの互換性

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
selectNode

Legend

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

Full support
Full support

関連情報