Search code examples
javascriptjqueryraphael

Change a CSS style of Raphael text with javascript


I can change a CSS attribute of a Raphael text with jQuery like so:

var text = paper.text(10,10,'abc');
$(text.node).css('font-style','italic');

How can I do the same with just javascript and no jQuery?


Solution

  • In javascript, use element.style.property = 'new-style'; to edit styles of an element.

    var text = paper.text(10,10,'abc');
    text.node.style.fontStyle = 'italic';