JavaScript Code
<script type="text/javascript>
function updateTotal() {
document.getElementById('total').value = parseFloat(document.getElementById('cheque').value) + parseFloat(document.getElementById('cash').value);
}
</script>
Input Fields
<input type="text" name="cheque" id="cheque" onChange="updateTotal()" />
<br>
<input type="text" name="cash" id="cash" onChange="updateTotal()" />
Result Field
<input type="text" id="total" readonly="readonly" name="total" />
If I enter 100.100 in the cheque field and 200 in the cash field, the total is displayed as 300.1, but I want it to display 300.100. How can this be achieved?