Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Range startContainer property

  • Last Updated : 30 Jun, 2020

The startContainer property returns the Parent Node within which the Current Range starts. This is a read only property.

Syntax:

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!

ParentNode = range.startContainer;



Return Value: 

  • Returns the node within which the current range starts.

Example: This example will show how to get the startContainer Node of the Current Range.



HTML




<html>
<head>
<title>HTML DOM range startContainer property</title>   
</head>
<body>
    <h1>GeeksforGeeks</h1>
     
<p>This is the Range Content</p>
 
</body>
<script>
    let range = document.createRange();
    let referenceNode = document.getElementsByTagName('p').item(0);
    range.selectNode(referenceNode);
    console.log(range.startContainer);
</script>
</html>

Output: In console, we got the startContainer Node for our range.

Supported Browsers: 

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera
  • Internet Explorer
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!