Related Articles

Related Articles

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

The SVG Element.part property returns a DOMTokenList which represents the part identifiers for the given element.

Syntax:

let elementPartList = element.part

Return value: This property returns a DOMTokenList which represents the part identifiers of the given element.

Example 1:

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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');
            g.part = 'geeksforgeeks';
            console.log(g.part);
        </script>
    </svg>
</body>
  
</html>

chevron_right


Output:



Example 2: 

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

full-stack-img




My Personal Notes arrow_drop_up
Recommended Articles
Page :