Jump to content

Number formatting currency


matfish

Recommended Posts

Hi there,

 

I have a shopping basket which I'm trying to add up in JS depending on which delivery method the customer chooses, however I have values such as 1,200 + 25.00 but I keep getting "NaN" when trying to add them

 

I have a feeling it's the larger values - any help?

Link to comment
https://forums.phpfreaks.com/topic/212224-number-formatting-currency/
Share on other sites

Brilliant thank you.

 

Removing the comma in the string, converting it to a number then adding the amounts together worked a treat.

 

However, how do I go about number formatting this back to x,xxx.xx like UK currency?

 

Many thanks for your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.