I am working on a calculator and would like it to round to about 5 decimal places. Here is my javascript code to get an inout and produce the output:
<div class="input">
Price paid per share: <input id="value1" type="text" /><br>
Number of shares bought: <input id="value2" type="text" /><br>
Commission/ fee's paid: <input id="value3" type="text" /><br>
<center><input type="submit" class="submit" onclick="output();"></center>
</div>
<center><p class="result" id="result"> </p></center>
<script type="text/javascript" language="javascript" charset="utf-8">
function output(){
var value1 = document.getElementById('value1').value;
var value2 = document.getElementById('value2').value;
var value3 = document.getElementById('value3').value;
document.getElementById('result').innerHTML = ((parseFloat(value1) * parseFloat(value2)) + (parseFloat(value3))) / (parseFloat(value2));
}
Anyone know how I could round my output/ results to about 5 decimal places? Thanks.