HTML DOM Range endContainer property

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

filter_none

edit
close

play_arrow

link
brightness_4
code

<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>

chevron_right


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



Supported Browsers:

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

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.