Change JavaScript text

1

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;
    
asked by anonymous 06.11.2014 / 22:45

1 answer

2

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.

    
06.11.2014 / 22:52