I made a simple javascript that multiplies an amount and shows the result. However, I want to limit the result to 2 decimals. I've tried using toFixed, but that doesn't seem to work.
Does anyone know how to make this work?
function MultiplyTheAmount() {
var multiplier = 0.75;
var roundedMultiplier = multiplier.toFixed(2);
document.getElementById('multiplyResult').innerHTML = document.getElementById('multiplyAmount').innerHTML * roundedMultiplier;
};
MultiplyTheAmount();
<ul style="list-style:none;">
<li>Amount:</li>
<li id="multiplyAmount">119.99</li>
<li><br/></li>
<li>Multiply by:</li>
<li>0.75</li>
<li><br/></li>
<li>Result:</li>
<li id="multiplyResult"></li>
</ul>