We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The Range() constructor returns a newly created Range object whose start and end is the global Document object.

Syntax

range = new Range()

Example

range = new Range();
endNode = document.getElementsByTagName("p").item(3);
endOffset = document.getElementsByTagName("p").item(3).childNodes.length;
range.setEnd(endNode,endOffset);

Specification

Specification Status Comment
DOM
The definition of 'Range.Range()' in that specification.
Living Standard Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes Yes24 No15 Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes Yes2415 Yes ?

See also

 

Document Tags and Contributors

Contributors to this page: fscholz, bethge, teoli, jsx, kscarfone, Sheppy
Last updated by: fscholz,