I have an SVG file saved externally that includes the following code:
<g
inkscape:groupmode="layer"
id="layer9"
inkscape:label="score"
style="display:inline">
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:22.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="100.3568906"
y="20.353357"
id="text5833"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan5834"
x="300.3568906"
y="20.353357">Score</tspan></text>
</g>
I am attempting to dynamically update the text "Score" using a JavaScript file, but so far I haven't been successful.
This is what I have tried:
var list = layerNamed('score').getElementsByTagName("g");
var textNode = document.createTextNode("Score:-1");
list.appendChild(textNode);