Forum Discussion

MattBotelho's avatar
MattBotelho
Community Member
4 months ago

JavaScript not working

Hello, In an effort to create Dark Mode in JavaScript, I have been attempting using codes that change shapes and text into different colors. For whatever reason, codes that I once used are no longer...
  • MathNotermans-9's avatar
    4 months ago

    The first part is easy. You forgot the "" around the color.

    let pointStar = document.querySelector('[data-acc-text="star5Points"]');
    gsap.to(pointStar, {duration:0.7,scale:1.5});
    let pathElement = pointStar.querySelector('path');
    console.log("pathElement: "+pathElement);
    
    pathElement.setAttribute('fill', "#C0504D");



    Then this works fine. Little note to everyone coding in Javascript in Storyline, when testing i noticed giving the variable a numeric as first character...Storyline fails on that.
    So pointStar works fine... 5pointStar will fail ;-)