Jump to content

Adding 2 numbers


everisk

Recommended Posts

Hi,

 

I'm very new to Javascript and found a very strange behaviour when trying to add 2 numbers. DOnt know if i got everything right. Below is my code.

 

price = document.getElementById("price").value;
vat_p = (price*0.07)+price;
document.getElementById("price").value=vat_p;

 

 

Instead of adding (price*0.07) to price, price was appended to the result of (price*0.07).Help please~

Link to comment
https://forums.phpfreaks.com/topic/103246-adding-2-numbers/
Share on other sites

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.