• Resolved plepicier

    (@plepicier)


    Hello

    Is it possible to add a space directly in the number?
    Example 50000 -> 50 000

    I saw that it was possible to put commas by changing the input “number” by “text” but when I put a space the number is not taken into account and is displayed NaN.

    Thanks in advance,
    Pierre

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @plepicier,

    Go to plugin > Plugins Editor > Select Counter Number Showcase > assets > js > select counter_nscript.js replace this code to below code.

    jQuery(document).ready(function( jQuery ) {
            jQuery('.counter').counterUp({
                delay: 20,
                time: 2000
            });
        });

    To

    jQuery(document).ready(function($) {
        $('.counter').each(function () {
            $(this).prop('Counter',0).animate({
                Counter: $(this).text()
            }, {
                duration: 4000,
                easing: 'swing',
                step: function (now) {
                    // $(this).text(Math.ceil(now));
                   $(this).text(Math.ceil(now).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 "));
                }
            }); 
        });
    });

    If it works or not let us know.

    Thanks

    Thread Starter plepicier

    (@plepicier)

    Hello
    
    It works correctly. Thank you for your reactivity
    
    Pierre
    Praveen

    (@praveenmalav09)

    Hi, @plepicier,

    Glad that your issue has been resolved if you like our plugin please rate us.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add a space in the number’ is closed to new replies.