To get the width of an SVG circle using jQuery, you can use the 'attr()' method to retrieve the value of the 'r' attribute, which specifies the radius of the circle. Here is an example:

HTML:

<svg>
  <circle cx='50' cy='50' r='25' />
</svg>

jQuery:

var circleWidth = $('circle').attr('r') * 2;
console.log(circleWidth);

This code will retrieve the value of the 'r' attribute (which is 25 in this example), multiply it by 2 to get the diameter of the circle, and store it in the 'circleWidth' variable. The 'console.log()' statement will then print the value of 'circleWidth' to the console.

How to Get SVG Circle Width with jQuery

原文地址: https://www.cveoy.top/t/topic/odad 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录