Animated counter

I’m using a counter that animates to a given number once the user scrolls to the div. Here is the CodePen:

How can I add commas to the number counter? (ex. “300,000”)

If I add commas to the data-count, it returns as not a number.

Thanks to whoever can help me! :slight_smile:

Here you go…

step: function() {
          complete: function() {

Using toLocaleString will use commas for everywhere it uses them, and I believe periods for those locales that use them too. Either way, it uses the separators. Notice above how we use toLocaleString on the counts.


Worked perfectly! Thanks! :slight_smile: