Skip to content
Related Articles

Related Articles

SVG Element.innerHTML Property
  • Last Updated : 05 Nov, 2020

The SVG Element.innerHTML property returns innerHTML of the given element.

Syntax:

const content = element.innerHTML

Return value: This property returns innerHTML of the element.

Example 1: 




<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="100" 
        xmlns="http://www.w3.org/2000/svg">
          
        <a href="https://www.geeksforgeeks.org" id="gfg">
              
            <text x='100' y='50' font-size="50px">
                GfG
            </text>
        </a>
          
        <script>
            var g = document.getElementById('gfg');
            console.log(g.innerHTML);
        </script>
    </svg>
</body>
  
</html>

Output:



Example 2: 




<!DOCTYPE html>
<html>
  
<body>
    <svg width="350" height="100" 
        xmlns="http://www.w3.org/2000/svg">
          
        <a href="https://www.geeksforgeeks.org" id="gfg">
            <circle cx='100' cy='50' r="50"> </circle>
        </a>
          
        <script>
            var g = document.getElementById('gfg');
            console.log(g.innerHTML);
        </script>
    </svg>
</body>
  
</html>

Output:

My Personal Notes arrow_drop_up
Recommended Articles
Page :