Wednesday, July 3, 2024
HomeLanguagesJavascriptHTML DOM Range startContainer property

HTML DOM Range startContainer property

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

Syntax:

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>neveropen</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 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Safari 1 and above
  • Opera 9 and above
  • Internet Explorer 9 and above
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

Calisto Chipfumbu
Calisto Chipfumbuhttp://cchipfumbu@gmail.com
I have 5 years' worth of experience in the IT industry, primarily focused on Linux and Database administration. In those years, apart from learning significant technical knowledge, I also became comfortable working in a professional team and adapting to my environment, as I switched through 3 roles in that time.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments