Hot to get user’s regional settings for currency in JavaScript or jQuery?
问题 I’m trying to format some numbers with jQuery. I would like to get the user’s regional settings for currency and number, in order to implement the correct format (obtain the decimal separator). Is it possible to retrieve these parameters with jQuery or JavaScript? 回答1: Use toLocaleString() with style:'currency' : var amount = 123.56; alert( 'German: ' + amount.toLocaleString('de-DE',{style:'currency',currency:'EUR'}) + ', ' + 'American: ' + amount.toLocaleString('en-US',{style:'currency'