dominicmcafee Posted March 27, 2014 Share Posted March 27, 2014 Given the following code: updateTotal: function () { var total = 0; $('input#itemLineTotal').each(function (i) { price = $(this).val().replace("$", ""); if (!isNaN(price)) total += Number(price); }); $('#subTotal').html("$" + this.roundNumber(total, 2)); var grdTotal = total + this.updateSalesTax(); grdTotal = this.roundNumber(grdTotal, 2); $('#grandTotalTop, #grandTotal').html("$" + grdTotal); }, updateSalesTax: function () { var total = 0; $('input#itemLineTotal').each(function (i) { price = $(this).val().replace("$", ""); if (!isNaN(price)) total += Number(price); }); var tax = $("#tax").val(); $("#salesTax").html("$" + mioInvoice.roundNumber(tax, 2)); return tax; }, How can add the tax to the total to give the grand total. Please help Link to comment https://forums.phpfreaks.com/topic/287335-javascript-calculations/ Share on other sites More sharing options...
dominicmcafee Posted March 27, 2014 Author Share Posted March 27, 2014 Please help guys Link to comment https://forums.phpfreaks.com/topic/287335-javascript-calculations/#findComment-1474141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.