Hi folks, I have a database object called player_credits
I’m running a JS to transform that to currency. It works fine.
$(".convertCommas").each(function(element){
$(this).html( $(this).html().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,") );
});
I’ve set this in a loop of every 100ms
But the problem is it then becomes $1,000$1,001 when I add 1 to it. Then $1,000$1,001,$105 when I add 4 more.
What’s the right way to do this?