Skip to content
Related Articles

Related Articles

Improve Article

SVG Document.documentElement Property

  • Last Updated : 03 Nov, 2020

The SVG Document.documentElement property returns the root element of the document.

Syntax:

const element = document.documentElement

Return value: This property returns the root element of the document.

Example 1:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="500" 
        xmlns="http://www.w3.org/2000/svg">
          
        <circle cx="100" cy="100" r="50"></circle>
          
        <script>
            console.log(document.documentElement)
        </script>
    </svg>
</body>
  
</html>

Output:



Example 2:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="500" 
        xmlns="http://www.w3.org/2000/svg">
          
        <text x="20" y="20">GeeksforGeeks</text>
          
        <script>
            console.log(document.documentElement)
        </script>
    </svg>
</body>
  
</html>

Output:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :