I needed something very similar to what you want except I needed to be able to animate changes in dollars and cents (similar to a Turbotax counter). I couldn't find anything helpful online so I hacked this together from several examples on SO. The key is to use the step callback function to format the value as you please. The cool thing is this works whether you're going up or down in the value.
Hope this code helps you.
<div id="total">$9.99</div>
<script>
//NOTE: Always work with currency in total value in cents,
//hence the need for .toMoney() and .fromMoney()
var $total = jQuery("#total");
var finaltotal = 29999; //$299.99
var currval = $total.text().fromMoney();
//only animate if the values are different
if(currval !== finaltotal) {
console.log("start: " + currval);
console.log("end: " + finaltotal);
$({"counter": currval })
.animate({ counter: finaltotal },
{
duration: 500,
easing: "swing",
step: function() {
$total.text( this.counter.toMoney() );
},
complete: function() {
//animate is a bit off more often than not.
//Nobody will notice if the animation happens quickly
//so after the animate is done we slam in the final value.
$total.text( finaltotal.toMoney() );
console.log("animate complete");
}
});
}
//Convert a currency string (with or without dollar sign or commas)
//to an integer representing total value in cents
//E.g.: $149.99 becomes 14999
String.prototype.fromMoney = function() {
return parseInt(this.replace(/^\$/,'').replace(/,/g, '').replace(/\./, ''));
}
//Convert a given integer representing only cents ($149.99 = 14999) to a
//proper, comma delimited US dollar amount with the dollar sign
//Modern browsers from IE 11 onward support
//foo.toLocaleString("en-US", {style:"currency", currency:"USD"});
//but the method below works for most older browsers.
//Found on SO @ http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript
Number.prototype.toMoney = function(c, d, t) {
var n = this/100,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "." : d,
t = t == undefined ? "," : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + "$" + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3}) (?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
</script>