05-01-2019 15:17
05-01-2019 15:17
Hi guys
I am having this weird issue with my code. What I want to do is to use DOM in order to change the fill color of a circle in SVG. However, the thing is that the circle's color doesn't change and stays the color I created it as. What's even more strange is that to debug I logged the fill color of the circle after the color change. I saw that the circle's fill color accessed via DOM was the color I wanted it to be, but the color change wasn't shown on the watch display. Here is my SVG code:
<circle cx="50%" cy="50%" r="20" fill="black" id="foo" />
and here is my JS code:
import document from "document"; var someCircle = document.getElementById("foo"); someCircle.fill = "#00FF00;
Can anyone tell me why this isn't working, and how to fix it? Thanks!
Answered! Go to the Best Answer.
05-01-2019 15:20
05-01-2019 15:19
05-01-2019 15:19
Hi guys
I am having this weird issue with my code. What I want to do is to use DOM in order to change the fill color of a circle in SVG. However, the thing is that the circle's color doesn't change and stays the color I created it as. What's even more strange is that to debug I logged the fill color of the circle after the color change. I saw that the circle's fill color accessed via DOM was the color I wanted it to be, but the color change wasn't shown on the watch display. Here is my SVG code:
<circle cx="50%" cy="50%" r="20" fill="black" id="foo" />
and here is my JS code:
import document from "document"; var someCircle = document.getElementById("foo"); someCircle.fill = "#00FF00;
Can anyone tell me why this isn't working, and how to fix it? Thanks!
05-01-2019 15:20
05-01-2019 15:20
Untested:
someCircle.style.fill
05-01-2019 17:20
05-01-2019 17:20
05-01-2019 17:33
05-01-2019 17:33
*phew*