I used toLocaleString()
method to input money comma in `javascript. But the problem is, IE and chrome browser result correctly except Safari browser. I delete cache several times but still doesn't work.
var test = 12300;
console.log('test:'+test.toLocaleString());
// 12,300 in IE,Chrome
// 12300 in Safari
The issue here is that number.toLocaleString is implemented differently on different browsers. On Safari, it chooses not to display with the person-friendly formatting we're used to. It is supported on safari, but its implementation isn't the same as IE, Chrome, or Firefox. See this link: http://forums.asp.net/t/2031925.aspx?toLocaleString+function+is+inconsistent+with+browser+
Also, Safari doesn't support using the locale parameter with toLocaleString, in case you tried setting that: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With