Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140161

Countup.js final number does not have comma

$
0
0

I am a javascript noob, no question.

I have JQuery CountUp on my screen and have looked through some of these forums. The counter shows a comma while counting up but the final number (102,050) still shows no comma (102050)

any pointers? here is the code as it sits now...

    $('.counter').each(function() {
  var $this = $(this), 
      countTo = $this.attr('data-count');

  $({ countNum: $this.text()}).animate({
    countNum: countTo
  },

  {

    duration: 1500,
    easing:'linear',
    step: function() {
      $this.text(Math.floor(this.countNum).toLocaleString('en'));
    },

    complete: function (now) {
      now = Number(Math.ceil(now)).toLocaleString('en');
        $(this).text(now);
      $this.text(this.countNum).toLocaleString('en');
      //alert('finished');
    }

  });

Viewing all articles
Browse latest Browse all 140161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>