Having trouble applying style to SVG using JavaScript upon object creation
- by Jack Roscoe
Hi,
I have a function which creates an SVG text object using JavaScript. As soon as the object is created, I want it to have the style attribute which in CSS would be text-anchor: left.
Currently, it doesn't work. I have tried many variations, and I also read that when using styles in JavaScript you must remove any '-' dashes and format the attribute name in camel casing (is this true?).
Can anybody spot my mistake? Here's my code:
RenderTextBox:function()
{
this.textBox = paper.text(this.x, this.y, this.htmlTextBox);
this.textBox.style.textAnchor="left";
}