Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Range startOffset property

  • Last Updated : 30 Jun, 2020

The startOffset property returns a number representing an Offset index where the Range starts. This is a read-only property.

if the parent node of Range is a Node of type Text then the offset index will be the number of characters from the start of the Range. For other Node types, the startOffset is the number of child nodes from the start of the startContainer parent node.


start = range.startOffset;

Return Value: It returns a Offset index of starting of the range.

Example: In this example, we will use this property to get startOffset index.

Here the range’s startOffset index in 3rd node from startContainer node.


<title>HTML DOM range startOffset property</title>   
<p>This is the Range Content</p>
    let range = document.createRange();
    let referenceNode = document.getElementsByTagName('p').item(0);

Output: In console, the startOffset Index can be seen.

Supported Browsers: 

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera
  • Internet Explorer

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!