javascriptsahi

How to access 'fill' element of circle tag in sahi code


I want to access the fill element of circle tag in <svg> tag and assign the value to a variable.

fill value is #08C65B.

I tried with the below line but unable to get it:

document.getElementsByTagName("svg")[0].document.getElementsByTagName("circle")[0].getAttribute("fill")

var y = document.getElementsByTagName("svg"[0].document.getElementsByTagName("circle")[0].getAttribute("fill")

enter image description here


Solution

  • This works document.getElementsByTagName("circle")[0].getAttribute("fill"));