Spaces between numbers with JS - help needed!


I’m trying to use a piece of JS code I found on StackOverflow to automatically create spaces in numbers - eg. 9 999 999 instead of 9999999. It’s the way we use numbers in our country.

How can I make it work on Webflow though? Is there a way to affect only specific classes? And are these non-breaking spaces (and if not, can they be)?

One last thing that may or may not be important - I’m pulling the numbers that I need to affect from a CMS collection.

Here’s the code:

function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");

I’m primarily a designer so this is new to me. Any help would be appreciated!

Here is my site Read-Only: Webflow - Hanousek a partneři

hi @jindrich.d I have send you PM with video where I explain how to.

Have a great day