Convert currency to 1,000.00 format

Asked

Viewed 65 times

1

I am using a custom script that prints the value of the coin with comma, but this inserting point in the case of thousands.

Currently he prints like this: 1000.00

I need him to print that way: 1,000.00

Follows part of the code responsible for printing:

pai.find('.valor_original').html(escolha != 1 ? '<strong><span class="strike">R$ '+preco.toFixed(2).replace(".",",")+'</span></strong>' : '<strong>Altere a</strong>'); 

The value he receives is with a dot: 1000.00, then it is converting to comma. How should I change the replace in that case?

I need to know how to modify this specific script.

  • Dude, take a look at the other questions. The replace you’re doing just swaps the dot for the comma.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.