var num1 = "5.54";
var num2 = "10";
result = (num1/num2)*100;
With javascript the result shows 50. But If I do the math using a calculator I find 55.4 which is correct. Would you please kindly help with the javascript code to make the result 55.4.
…
Hi,I have managed to make it work using parseFloat
example- var num1 = parseFloat(document.getElementById(“obtainedmark”).value);
var num2 = parseFloat(document.getElementById(“totalmark”).value);
Thanks.:)
use parseFloat:
edit:
I just checked and it works without parsing as well. The problem is somewhere else in your code.