I want to change text tag text with JavaScript.
<text id =txtrect x="5" y="35" font-family="Verdana" font-size="11" fill="white" >
Rect
</text>
I tried this but it does not change
document.getElementById(txtrect).innerHTML=teste;
I want to change text tag text with JavaScript.
<text id =txtrect x="5" y="35" font-family="Verdana" font-size="11" fill="white" >
Rect
</text>
I tried this but it does not change
document.getElementById(txtrect).innerHTML=teste;
Switch to:
<text id="txtrect" x="5" y="35" font-family="Verdana" font-size="11" fill="white" >
Rect
</text>
and
document.getElementById("txtrect").innerHTML="teste";
This should solve your problem.
Update
I recommend you take a look at this tutorial: link It will solve your problems with javascript.