# How to Change the decimal representation

**URL:** <https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [November 21, 2021, 8:59pm UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073 "2021-11-21T20:59:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vuedesprit](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vuedesprit/32/30954_2.png) [@vuedesprit](https://forum.wixstudio.com/u/vuedesprit)\
**Post date:** [November 21, 2021, 8:59pm UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/1 "2021-11-21T20:59:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jacobg](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jacobg/32/29611_2.png) [@jacobg](https://forum.wixstudio.com/u/jacobg)\
**Post date:** [November 22, 2021, 5:55am UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/2 "2021-11-22T05:55:00Z")

</div>

HI @vuedesprit , have you tried this?

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

```

Expect:

```javascript
123,456.789

```

---

<div class="post-metadata">

**Author:** ![vuedesprit](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vuedesprit/32/30954_2.png) [@vuedesprit](https://forum.wixstudio.com/u/vuedesprit)\
**Post date:** [November 22, 2021, 8:32am UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/3 "2021-11-22T08:32:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [November 22, 2021, 10:27am UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/4 "2021-11-22T10:27:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vuedesprit](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vuedesprit/32/30954_2.png) [@vuedesprit](https://forum.wixstudio.com/u/vuedesprit)\
**Post date:** [November 22, 2021, 12:46pm UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/5 "2021-11-22T12:46:01Z")

</div>

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

 ![](https://us1.discourse-cdn.com/wix/original/3X/a/1/a170679f0daad75f7116e257797c626f9e231c04.jpeg)

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [November 22, 2021, 1:05pm UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/6 "2021-11-22T13:05:54Z")

</div>

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.

> **[Is there a way to constrain the size of a text box? | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/is-there-a-way-to-constrain-the-size-of-a-text-box)**
>
> I have an unlimited character in a text entry form, but in the repeater display, I only want a few characters of the full input to show. So i'm needing to truncate the full text in the display, and then the full read out will display in the...

> **[How do I add a 'Read More' button to a repeater | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/how-do-i-add-a-read-more-button-to-a-repeater)**
>
> My repeaters are coming up all different sizes as the txt length varies. I would like to have a 'read more' buttons so all profiles in the repeater can be the same until expanded
> 
> Any advice is greatly apricated 😸

> **[Expandable text box- read more button doesn't move with text | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/expandable-text-box-read-more-button-doesn-t-move-with-text-1)**
>
> I'm creating and expandable text box on my website following the directions here: https://support.wix.com/en/article/creating-an-expandable-text-box-with-a-show-more-link-using-wix-code
> 
> The "Show more" button does not relocate to the bottom of the...

> **[multiple expandable boxes with read more | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/multiple-expandable-boxes-with-read-more)**
>
> Hello, i reach out to support on how to create a expandable box with a read more button and they sent me to the below link which worked.
> https://support.wix.com/en/article/request-expandable-text-boxes-with-a-read-more-link 
> 
> but i need to add...

> **[Create "Read More"/ "Read Less" links using a multi-state box | Velo by Wix](https://community.wix.com/velo/forum/tips-tutorials-examples/create-read-more-read-less-links-using-a-multi-state-box)**
>
> (Note: For a detailed step-by-step tutorial on this topic, click here.) 
> 
> Hey, did you know you can expand text using a "Read More" button with just a few lines of code?
> 
> 
> 
> Here's how:
> 1. Add a multi-state box (MSB) to your page.
> Now you're in State1...

---

<div class="post-metadata">

**Author:** ![vuedesprit](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/vuedesprit/32/30954_2.png) [@vuedesprit](https://forum.wixstudio.com/u/vuedesprit)\
**Post date:** [November 22, 2021, 2:39pm UTC](https://forum.wixstudio.com/t/how-to-change-the-decimal-representation/3073/7 "2021-11-22T14:39:42Z")

</div>

Thank you @russian-dima , much appreciated.
