Spaces between numbers with JS - help needed!

Hi,

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: https://preview.webflow.com/preview/hanousekapartneri?utm_medium=preview_link&utm_source=designer&utm_content=hanousekapartneri&preview=da063f5bfdfa8e59415ac277cacc36ed&pageId=6227005a51372335531d29ac&workflow=preview

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

Have a great day