Search code examples
javascriptjqueryarticulate-storyline

Changing Articulate Storyline text color using jquery?


Here is the code that I'm using to animate a text in Storyline using jQuery:

var item = $('[aria-label="myText"] svg')

$(item).toggle( "puff" );

this code is working.

But when I tried to change the color of the text using jQuery nothing happens...

if I can use jQuery to animate a text why I can't use it to change the color of it?

Here are the codes I've tried: (Am I missing something?!)

var item = $('[aria-label="spinner"] svg')

$(item).attr('style','color: green;');

and also :

var item = $('[aria-label="spinner"] svg')

$(item).css('color', 'red');

Solution

  • I can guess an SVG.. normally an svg containing text has also a <text></text> and svg are not using color but fill instead in the CSS.

    Changing to this should work:

    var item = $('[aria-label="spinner"] svg text')
    
    $(item).css('fill', 'red');