How to change text in svg graphics by javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

How to change text in svg graphics by javascript?

8th Jul 2017, 11:57 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
4 Answers
+ 4
You can get a reference of your <text> node svg element as any html element (using getElementById() and co') and access to the read/write property 'textContent': https://code.sololearn.com/WL2B0YsEk3SF
8th Jul 2017, 5:13 PM
visph
visph - avatar
+ 5
@Ankur Dutta Jha: It's a shame to set 'best answer' mark at your own answer, all the most when you have received at least one answer helping you ^^
13th Jul 2017, 7:30 AM
visph
visph - avatar
+ 5
Sorry I forget that I see the above code in your answer. Forgive me, really
13th Jul 2017, 7:50 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar
+ 4
Svg_TextTag_id.textcontent=input_id.value
13th Jul 2017, 6:11 AM
Ankur Dutta Jha
Ankur Dutta Jha - avatar