I am trying to animate numbers to count up to the number specified in a div. This works but I would like the number to include the necessary commas. For example 62000000 should display as 62,000,000 - is there a way to do this by adding the commas to the numbers in my div or by having js add the commas automatically? Demo http://jsfiddle.net/FbkpM/
$(function(){
var current = 0;
var finish = jQuery('#statAssistance .statNum').text();
var miliseconds = 3000;
var rate = 100000;
var counter = setInterval(function(){
if(current >= finish) clearInterval(counter);
$("#statAssistance .statNum").text("$" + current);
current = parseInt(current) + parseInt(rate);
}, miliseconds / (finish / rate));
});