I am currently creating a number counter (from 0 to a value) and I am having some trouble with getting the number to render if it's separated by a comma.
I have found some potential fixes such as toLocaleString but I can't get it to work - could anyone point me in the right direction?
Currently when I use 130,000 it returns NaN.
Thanks!
$('.panel-text-style-c').each(function() {
$(this).prop('Counter', 0).animate({
Counter: $(this).text()
}, {
duration: 2000,
easing: 'swing',
step: function(now) {
$(this).text(Math.ceil(now).toString());
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class='panel-text-style-c'>130,000</span>
The following above