Where would I add the toFixed
method in this code that calculates an amount so that I can control the decimal to 18 places and so I don't get incorrect calculations.
Right now 100,000 should return 51
, but it is returning 51.00000000000004
< script type = "text/javascript" >
$(document).ready(function() {
var qty = $("#qty");
qty.keyup(function() {
var total = isNaN(parseInt(qty.val() * $("#price").val())) ? 0 : (qty.val() * $("#price").val())
$("#total").val(total);
});
});
</script>