Jump to content


Changing Text

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts



I'm working on an animated timeline, as it plays there is a div showing month of the year, how do I change the text of that div as it plays




doesn't work


or how do just go & ask a bit of jquery to do the job?





Link to comment
Share on other sites

Hello marko, and Welcome to the GreenSock Forum!


I'm a little confused on what your asking.. if possible can you setup a codepen demo .. this way we can see your code in context.


Please go to the following link to learn how to set up a codepen demo, then re-post your example codepen link:




And read on how to setup a codepen demo so we can better understand whats not working in your code.


To create a demo that uses the latest version of TweenMax:

  1. Visit the GreenSock 

    See the Pen nwbIi by GreenSock (@GreenSock) on CodePen

  2. Click the "Fork" button to create your own copy.
  3. Add the minimal amount of HTML, CSS and Javascript necessary to replicate your issue.
  4. Paste the URL of your pen (demo) into a new forum topic with a short description of the problem.
  5. Include OS, browser and device information where applicable. 

As far as using jQuery to change the text you would use the text() method:



// get text on element
​var myText = jQuery("#month").text();

// set text on element

or using native JavaScript:

// get text of element
var content = element.innerHTML;

// set text of element
element.innerHTML = content;

 you could also use innerText



  • Like 1
Link to comment
Share on other sites

Welcome to the GreenSock forums. Two ways I might try this:



tl.call(changeMonth, ["February"]);

function changeMonth(newtext) {



TextPlugin is probably the more robust choice, it allows you to rewind/restart your timeline and the text will revert to what it was previously.

  • Like 4
Link to comment
Share on other sites



thanks for both getting back so quickly


the function works but I can then figure how to get it to trigger off labels


I've had a go at a 'code pen' demo






Link to comment
Share on other sites



thats working using the cdn gsap 






Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.