I have these numbers
10999
and 8094
and 456
And all i want to do is add a comma in the right place if it needs it so it looks like this
10,999
and 8,094
and 456
These are all within a p tag like this <p class="points">10999</p>
etc.
Can it be done?
I've attempted it here with the help of other posts http://jsfiddle.net/pdWTU/1/ but can't seem to get it to work
Thanks
Jamie
UPDATE
Messed around a bit and managed to figure it out here http://jsfiddle.net/W5jwY/1/
Going to look at the new Globalization plugin for a better way of doing it
Thanks
Jamie
Take a look at recently released Globalization plugin to jQuery by Microsoft
Here is my coffeescript version of @baacke's fiddle provided in a comment to @Timothy Perez
Using toLocaleString ref at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
I'm guessing that you're doing some sort of localization, so have a look at this script.