How to Change the decimal representation

Hello All, please i need help to change the decimal representation to be US format, so i need to swap comma and point. Please let me know your thoughts about this.
Thanks

HI @vuedesprit , have you tried this?

function toUsFormat(x){   
    return x.toLocaleString('en-US')
}
console.log(toUsFormat(123456.789))

Expect:

123,456.789

Hi Jacob, thank you for your reply. it is my first time in velo, so no idea where to put this code, I’ll appreciate it if you can highlight on this.

@vuedesprit

  1. find/select the page where you have your mentioned element on

  2. activate Dev-Mode

  3. Place your Code into the code-section-panel (at bottom of your wix-editor)

  4. do not forget to complete your code by adding the onReady-part.

Thank you all for your help,
@velo-ninja thank you for your instructions, i tried to follow you but it seems i failed somewhere

$w . onReady ( function () {
// Write your JavaScript here

// To select an element by ID use: $w('#elementID') 

// Click 'Preview' to run your code 

});

this is what i see when i open the product page

i replaced it with the following with no success:

$w . onReady ( function () {
function toUsFormat (x){ return x . toLocaleString ( ‘en-US’ )} console . log ( toUsFormat ( 123456.789 ))
});

The good news is that all is solved once i set region and currency in the dashboard also with no code.

I still have one question please:
(ref. attached image)
how can i split the product name on two lines (ex. the product on the left) so the two products are well aligned, or maybe there is another trick to align the products buttons, quantity, names…

Thank you in advance for all your help

You do NOT give enough informations about your SETUP.

-How is your project-setup?
-Which elements are used?
-Dataset-connections included/present?
-Seems like you use a REPEATER?

Elaborate more about your project-setup.

To get a good alignment you will need to have always the same length of TEXT repeated in your REPEATER. This for you have 2 possibilities…

  1. …resizing the text-box + text
  2. cutting the text if it is off limit

or even a third solution would be to generate a function, which would do both processes.

Thank you @russian-dima , much appreciated.