Open In App

SVG UseElement.y Property

Last Updated : 30 Mar, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The SVG UseElement.y property returns an SVGAnimatedLength object corresponding to the attribute of the given use element.

Syntax:

UseElement.y

Return value: This property returns SVGAnimatedLength object that can be used get the y of the use element.

Example 1: 

HTML




<!DOCTYPE html> 
<html
  
<body>
  <svg width="400" height="500"
        xmlns="http://www.w3.org/2000/svg">        
        <circle id="gfg" 
                cx="100" 
                cy="100" 
                r="70" 
                fill="green"/> 
            
        <use href="#gfg" x="110" y="320" id="useid"></use
        <script type="text/javascript">
          var u = document.getElementById("useid");
          console.log(u.y);
          console.log(u.y.animVal.value)
        </script>
    </svg
</body>
</html>


Output:

Example 2: 

HTML




<!DOCTYPE html> 
<html
  
<body>
  <svg width="800" height="800"
        xmlns="http://www.w3.org/2000/svg">        
        <rect id="gfg" 
                x="100" 
                y="100" 
                height="150"
                width="150"
                fill="green"/> 
            
        <use href="#gfg" x="200" y="200" id="useid"></use
        <script type="text/javascript">
          var u = document.getElementById("useid");
          console.log(u.y);
          console.log(u.y.animVal.value)
        </script>
    </svg
</body>
</html>


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads