This might be something trivial to solve, but I can't seem to figure it out. document.getElementById selects the tspan I'm trying to write data to, but nothing shows up. Code as follows. The var percentAS is set to 71, which is working fine. No errors in the console. Note this is a minimized version of my code there's actually a lot more in the document.
<body>
<text id="data" fill="white" x="460" y="160">
{{signups.[0]}} -
<tspan id="percentAS"></tspan>
</text>
</body>
<script>
document.getElementById("percentAS").innerHTML = percentAS + "%";
</script>
I tried logging some data to the console to see what was going on:
console.log(document.getElementById("percentAS"));
And this is returned in the error console:
tspan#percentAS.[object SVGAnimatedString]
innerHTML: "71%"
__proto__: SVGTSpanElementPrototype
EDIT Others have asked for more context, but I know for sure that there is nothing interfering with what I pasted above, or I would have added more context. It's just some basic sgv polygons that are a huge pain to read because they have so many points, which is why I didn't include them.
EDIT 2 It appears that my issue is unique to the Safari web browser, as I opened it in Chrome and Firefox and it works perfectly fine. I can't find any known issues with Safari in regards to this, although I've found a couple blog posts from a few years ago detailing a similar issue.
Looks like it's a problem with Safari web browser itself and not the code. I switched to using jQuery to do it:
and it worked just fine in all browsers.