AbstractRange: endContainer property

Baseline Widely available

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

The read-only endContainer property of the AbstractRange interface returns the Node in which the end of the range is located.

To change the end position, use the Range.setEnd() method or a similar one.

Value

The Node which contains the last character of the range.

Example

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

const endRangeNode = range.endContainer;

Specifications

Specification
DOM
# ref-for-dom-range-endcontainer①

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
endContainer
Chrome – Full support
Chrome 90 (Release date: 2021-04-13)
footnote Full support
Edge – No support
Edge 18 – 18 (Release date: 2018-10-02)
footnote Removed in 79 and later
Edge – Full support
Edge 90 (Release date: 2021-04-15)
footnote Full support
Firefox – Full support
Firefox 69 (Release date: 2019-09-03)
footnote Full support
Opera – Full support
Opera 76 (Release date: 2021-04-28)
footnote Full support
Safari – Full support
Safari 14.1 (Release date: 2021-04-26)
footnote Full support
Chrome Android – Full support
Chrome Android 90 (Release date: 2021-04-13)
footnote Full support
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote Full support
Opera Android – Full support
Opera Android 64 (Release date: 2021-05-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 14.5 (Release date: 2021-04-26)
footnote Full support
Samsung Internet – Full support
Samsung Internet 15 (Release date: 2021-08-13)
footnote Full support
WebView Android – Full support
WebView Android 90 (Release date: 2021-04-13)
footnote Full support
WebView on iOS – Full support
WebView on iOS 14.5 (Release date: 2021-04-26)
footnote Full support

Legend

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

Full support
Full support
Has more compatibility info.