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.
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
- 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>