Reputation: 1091
I'm trying to change the color of a SVGPathElement but it doesn't refresh. I check it gets the new color showing an alert but I don't see any difference. Is it because my SVG is retrieved by AJAX?
var element = document.getElementById(id);
alert(element.getAttribute("stroke"));
element.setAttributeNS(null, "stroke", "#000000");
Thanks in advance
Upvotes: 0
Views: 138
Reputation: 142612
you can try and set the stroke using style:
element.style.stroke='#0000';
Upvotes: 1