I'm trying to display properly formatted numbers in my autoForm input fields. The code below prints, as expected, to the console when I use a console.log statement. However, when returned to the client, 500000 displays 5,0,0,000 and .toLocaleString() doesn't work at all in the display or console. Any ideas?
Template.mortgage.events({
'keyup [name=cashOut]': function(){
var cashOut = event.target.value,
formatted = cashOut.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
event.target.value = formatted;
}
});