Possible Duplicate:
Format numbers in javascript
How to print a number with commas as thousands separators in JavaScript
I want to separate the zeros of the gap in the price list.
As example
current: 150000 wanted: 150 000
current: 2730000 wanted: 2 730 000
Using jQuery and all browsers (Chrome, Firefox, IE, Opera)
UPD I want to dynamically add spaces when entering numbers
Step by step: user entered 10, in input 10
100 - 100
1000 - 1 000
10000 - 10 000
100000 - 100 000
1000000 - 1 000 000
UPD I used regex
val.replace(/(\S)(?=(\S\S\S)+(?!\S))/g, "$1 ");
It's correct works in FF only