How can I find the class name of SVG attribute?
If it was div it would have been {reference to DIV}.className
But, this doesnt work exactly the same way with SVG element
Is there any jquery or javascript method/attribute to get the classes of a SVG element?
See below what I have tried:
Here's a jsfiddle: http://jsfiddle.net/Ujp76/
<body>
<svg class="c1"></svg>
<script>
window.addEventListener("load", function () {
var className = document.querySelector("svg").getAttribute("class");
console.log(className);
});
</script>
</body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With