Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Range endContainer property

  • Last Updated : 30 Jun, 2020

The endContainer property returns the Node within which the Current Range ends. This is a read only property.

Syntax:

parentNode = range.endContainer;

Return Value:

  • Returns the node within which the current range ends.

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

HTML




<html>
<head>
<title>HTML DOM range endContainer 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.endContainer);
</script>
</html>

Output: In console, we got the endContainer 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!