Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

SVG namespaceURI Property

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The SVG namespaceURI property returns namespaceURI of the given Attribute element.

Syntax:

namespace = attribute.namespaceURI

Return value: This property returns the namespaceURI of the Attr.

Example 1:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 100 100" 
        xmlns="http://www.w3.org/2000/svg">
          
        <!-- A link around a text -->
        <text id="gfg" y="20" x="20"
            Example
        </text>
          
        <script>
            const element = 
                document.querySelector("#gfg");
                  
            console.log(element.namespaceURI);
        </script>
    </svg>
</body>
  
</html>

Output:


Example 2:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 100 100" 
        xmlns="http://www.w3.org/2000/svg">
          
        <!-- A link around a shape -->
        <circle id="gfg" cy="20" cx="20" r="15"
            Example
        </circle>
          
        <script>
            const element = document.querySelector("#gfg");
            console.log(element.namespaceURI);
        </script>
    </svg>
</body>
  
</html>

Output:


Reference: https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI


My Personal Notes arrow_drop_up
Last Updated : 30 Mar, 2022
Like Article
Save Article
Similar Reads
Related Tutorials