我的样本Svg:
<circle cx="205.45282275086475" cy="187.9788644175314" r="69.64553108419807" id="07539aec-9d5d-4747-8878-0da5d505cb5f" stroke="#010101" fill="none" stroke-width="2" data-pdf-annotate-id="07539aec-9d5d-4747-8878-0da5d505cb5f" data-pdf-annotate-type="emptycircle" onload="init(evt)"class="hide000000003d495a02706fb486" aria-hidden="true" transform="scale(0.6) rotate(0) translate(0, 0)" style="cursor: pointer;"></circle>
如何通过使用其className获取元素
var prev_annotation = document.getElementsByClassName("hide000000003d495a02706fb486");
console.log(prev_annotation) // Am not getting the Element
我做错了什么?
答案 0 :(得分:1)
好像您放错了"
。
请尝试将此单行分成多行,以便您可以清晰地阅读代码。
<circle cx="205.45282275086475"
cy="187.9788644175314"
r="69.64553108419807"
id="07539aec-9d5d-4747-8878-0da5d505cb5f"
stroke="#010101"
fill="none"
stroke-width="2"
data-pdf-annotate-id="07539aec-9d5d-4747-8878-0da5d505cb5f"
data-pdf-annotate-type="emptycircle"
onload="init(evt)"
class="hide000000003d495a02706fb486【**】 __web-inspector-hide-shortcut__"
aria-hidden="true"
transform="scale(0.6) rotate(0) translate(0, 0)"
style="cursor: pointer;"></circle>