Detecting classname of SVGAnimatedString

I had a problem with a SVG map I was building, the functions triggered by
onmouseover on g were not working. I used then

window.onmouseover=function(e) {

to see if there was any problem with the classname, and then discovered than instead of the classname I was using, the system was detecting

SVGAnimatedString {animVal: "", baseVal: ""}

Something that never happened to me before the hundreds of times I’ve used similar code.
Any idea how can I get the actual classname of the g elements on mouseover? Thanks

Simplest way:

Another way:"class")

Make sure you also set the class name inside the svg path tags and then try"class")

That worked for me.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   How to bypass cloudflare bot/ddos protection in Scrapy?

Similar Posts