Code

Add Commas to Large Numbers

Easily add commas to large numbers in Webflow via a simple Javascript code snippet. This is perfect for unformatted CMS items, or other numbers utilized on a Webflow site.

Add Commas to Large Numbers preview

Easily add commas to large numbers in Webflow via a simple Javascript code snippet. This is perfect for unformatted CMS items, or other numbers utilized on a Webflow site.

How to add it

  1. Add the Javascript code snippet to the closing body tags of your page settings

The code

Javascript
                      <script>
var theNumber = 10000;
var commaNumber = theNumber.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); // will output 10,000
</script>

                    

Browse similar code snippets

Language

More from Corey Moen

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →