Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SVG javaScript method to set text content

 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can someone tell me how to set the text content of an SVG text Element
in javascript (ecmascript)?

Here is a sample of the problem:

My question is, what is the setmethod??, or the name of an "attribute" that will assign the text to this SVG text Element?

Explanation: The sample code illustrates how to use javaScript to create and set attributes to SVG elements such as rect, circle, and text (assuming you just want to modify attributes of a known text element by its "id").
I just can't find how to set the body content. Static SVG code will not suite my application.

Thanks for your help.
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, nevermind. I figured it out. The solution is to make the text content a child. I just had to find the method to set child:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic