tags:

views:

36

answers:

1

How may I change the text in a RaphaelJS-created text node? First, I am creating a new element with a text string with Raphael, and at some later point I would like to change this text. It's easier for me if I do not have to reinitialize the element as there will be a whole host of attributes attached that will be a pain to recreate. Is there a way to do this? I've got my logic below, but it doesn't work; it's there just to provide extra insight as to what I'm trying to achieve. Thanks

var R = Raphael("graph-o-matic", 1000, 1000);

var title = R.text( 10, 10, 'original text');

...

title.text.innerHTML = 'nifty new text here';

+3  A: 

Try this:

title.attr({text: 'nifty new text here'});
robertc
I was going to ask the exact same question, thanks for answering!
kevlar