我想在 svg 类中获取该属性,但它不起作用。
我正在使用 Django、html、php、查询。
<svg:path id="yui_patched_v3_18_1_1_1556774865622_2128"
pointer-events="visiblePainted" shape-rendering="auto" width="206" height="267.5" x="0" y="0" fill="none" stroke-dasharray="none"
stroke="#27aae1" stroke-linecap="butt" stroke-width="2" stroke-opacity="1" stroke-linejoin="round" transform="matrix(1,0,0,1,0,0)" style="left: 0px;
top: 0px; visibility: visible;"
class="yui3-shape yui3-svgShape yui3-path yui3-svgPath"
d=" M103, 267.5C154.5,267.5 206, 228 206, 188.5">
</svg:path>
我尝试了以下方法,但不起作用。
$(".yui3-shape yui3-svgShape yui3-path yui3-svgPath").each(function(index, item){
let temp = $(item).attr('s');
console.log("edge"+temp);
});
您选择了错误的选择器。如果您从一个选择器中选择多个类,那么您必须像这样添加它们:.yui3-shape.yui3-svgShape.yui3-path.yui3-svgPath
此外,您应该添加属性的正确名称:
$(".yui3-shape.yui3-svgShape.yui3-path.yui3-svgPath").each(function(index, item){
let temp = $(item).attr('stroke'); // Here you can add attributename as per your requierments
console.log("edge "+temp);
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句