Skip to main content
kineticcreative123
Inspiring
January 29, 2019
Answered

Need help adding a $ to a animated js counter

  • January 29, 2019
  • 1 reply
  • 1222 views

Hi Everyone,

I am working on a counter for a landing page and need help adding a $ in front of the numbers. I tried adding it here in the from: and too: but it didn't work. 

<script>

  jQuery(function($) {

    $('.count').countTo({

        from: 0,

        to: 2.5,

        speed: 1300,

  decimals: 1,

  separator: '.'

    });

});

</script>

Any help would be appreciated.

Here is a link to the counter:

Animate Counting To Number Example

    This topic has been closed for replies.
    Correct answer osgood_

    kineticcreative123  wrote

    Hi Everyone,

    I am working on a counter for a landing page and need help adding a $ in front of the numbers. I tried adding it here in the from: and too: but it didn't work. 

    <script>

      jQuery(function($) {

        $('.count').countTo({

            from: 0,

            to: 2.5,

            speed: 1300,

      decimals: 1,

      separator: '.'

        });

    });

    </script>

    Any help would be appreciated.

    Here is a link to the counter:

    Animate Counting To Number Example

    Find the 2 lines below in the script:

    var newVal = value.formatMoney(options.decimals, options.separator) + 'M';

    $(_this).html(newVal);

    and change to:

    var newVal = value.formatMoney(options.decimals, options.separator);

    $(_this).html('$' + newVal);

    Edited - Might be better to use &dollar;

    $(_this).html('&dollar;' + newVal);

    1 reply

    osgood_Correct answer
    Legend
    January 29, 2019

    kineticcreative123  wrote

    Hi Everyone,

    I am working on a counter for a landing page and need help adding a $ in front of the numbers. I tried adding it here in the from: and too: but it didn't work. 

    <script>

      jQuery(function($) {

        $('.count').countTo({

            from: 0,

            to: 2.5,

            speed: 1300,

      decimals: 1,

      separator: '.'

        });

    });

    </script>

    Any help would be appreciated.

    Here is a link to the counter:

    Animate Counting To Number Example

    Find the 2 lines below in the script:

    var newVal = value.formatMoney(options.decimals, options.separator) + 'M';

    $(_this).html(newVal);

    and change to:

    var newVal = value.formatMoney(options.decimals, options.separator);

    $(_this).html('$' + newVal);

    Edited - Might be better to use &dollar;

    $(_this).html('&dollar;' + newVal);

    kineticcreative123
    Inspiring
    January 29, 2019

    Thanks you osgood!! Works perfect!