Applying attribute to SVG using JS prompts 'this.textBox.style is undefined'. Why?

Posted by Jack Roscoe on Stack Overflow See other posts from Stack Overflow or by Jack Roscoe
Published on 2010-06-10T15:38:31Z Indexed on 2010/06/10 15:43 UTC
Read the original article Hit count: 290

Filed under:
|
|

Hi,

I'm using the following code to draw an SVG text box, and then change its text anchor attribute to 'left' as it defaults to center and that's nasty.

The text generates correctly, but when I add this second line I get the error 'this.textBox.style is undefined' in my error console.

Here's my code:

    RenderTextBox:function()
{
    // Render Text
    this.textBox = paper.text(this.x, this.y, this.htmlText);
    this.textBox.style.textAnchor="left";
}

Any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html5