Kamikaza - 8 months ago 35

Javascript Question

I need to calculate the total taxes from the total price to pay including the taxes, the tax rate is 19% so the correct calculation is for example

`total to pay = 1000 the taxes must be 160`

Why? Because 840 + 19% gives you the total price to pay = 1000 so you know the taxes of 1000 including taxes are not 190 with 19% rate but 160.

To calculate it with autofill the input I am using javascript like this to autofill many inputs

`totaltaxes.value = parseInt((parseFloat(totaltopay.value)*19)/100);}`

The problem is that I keep getting 190 as result of the 19% taxes and it must be 160.

Anyone have a formula to do this or idea how to calculate it? It is the 19% of the total price to pay including the taxes in the total price