I am trying to calculate in javascript. Some parts of the calculation are not working.
I want to calculate the total price with discount. For example: When price = 10.00 And discount = 50 (%)
I need to calculate: 10.00 * 0,50
So I need something like this:
var totalValue = numVal1 / 0, numVal2
When I do this, the script is not working. How can I fix this?
This is my full code:
function getPrice() {
var numVal1 = Number(document.getElementById("price").value);
var numVal2 = Number(document.getElementById("discount").value);
var totalValue = numVal1 / numVal2
document.getElementById("total").value = totalValue.toFixed(2);
}