updating tspan text
HTML
<body>
<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>
</body>
JavaScript
updateText("tspan5834", "A different score");
//updateTextWithJQuery("tspan5834", "now using jquery"); // uncomment this line to see how jquery works
function updateText(tspanId, txt) {
var spanEl = document.getElementById(tspanId);
while( spanEl.firstChild ) {
spanEl.removeChild( spanEl.firstChild );
}
spanEl.appendChild( document.createTextNode(txt) );
}
function updateTextWithJQuery(tspanId, txt) {
$("#"+tspanId).text(txt);
}