I'm not too familiar with Javascript so there's probably a really simple solution to this. All I want to do is add comma thousands separators to the output of this function:
function() {
return '$' + this.value;
}
So, for instance $100000 will display as $100,000. My problem is that I don't know how to deal with the variable this.value because of the period.
I tried:
function numberWithCommas(this.value) {
return '$' + this.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
My guess is that this.value.toString() is not proper syntax.
Thanks in advance.