turtleman2009
asked on
Javascript Calculator
I have this calculator: http://johnbarban.com/calculator/adonis.html the problem is that I need the results to only show 2 decimal places. Could someone show me what code I would use to make this happen?
Thanks
Thanks
ASKER
I just tried your solution and I could not get it to work, this is how I applied it:
document.getElementById('a donisideal waist').in nerHTML = idealwaist.toFixed(2);
Did I do it incorrectly?
document.getElementById('a
Did I do it incorrectly?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmm,
I am still having trouble with this.
When I use this code it completely stops calculating.
Any thoughts?
I am still having trouble with this.
When I use this code it completely stops calculating.
Any thoughts?
ASKER
It worked after all, it was just on my local machine that it wasn't working
It formats any number for "x" number of trailing decimals. The number is rounded up, and "0"s are used after the decimal point if needed to create the desired decimal length.
eg:
idealwaist.toFixed(2)
Cheers,
Hades666