How to implement calculating 10% discount base on sub total in js?. Here is my code.
<!-- Sub Total -->
function calculateGrandTotal() {
var grandTotal = 0;
$('table tbody tr td:nth-child(4) input').each(function (index) {
grandTotal += parseInt($(this).val());
});
$('#sub_total').val(grandTotal);
}
Use getElementbyID to obtain value of your subtotal field and apply the formula.