Firefox Tomorrow

web api instance method

Range: selectNode() method

View on MDN ↗

The Range.selectNode() method sets the Range to contain the Node and its contents. The parent Node of the start and end of the Range will be the same as the parent of the referenceNode.

Syntax

selectNode(referenceNode)

Parameters

  • referenceNode

Return value

None (undefined).

Examples

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

range.selectNode(referenceNode);

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also