Back to Content

AbstractRange: startContainer property

files/en-us/web/api/abstractrange/startcontainer/index.md

latest628 B
Original Source

{{APIRef("DOM")}}

The read-only startContainer property of the {{domxref("AbstractRange")}} interface returns the {{domxref("Node")}} in which the start of the range is located.

To change the start position, use the {{domxref("Range.setStart()")}} method or a similar one.

Value

The {{domxref("Node")}} inside which the start position of the range is found.

Example

js
const range = document.createRange();
range.setStart(startNode, startOffset);
range.setEnd(endNode, endOffset);

const startRangeNode = range.startContainer;

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}