1var subTotal="12.1345";// can also be int, float, string
2var subTotalFormatted=parseFloat(subTotal).toFixed(2); //"12.13"
3
1var totalAmount = 0;
2totalAmount = Number($("#sub_amount").val()) + Number($("#vat_amount").val());
3totalAmount = totalAmount.toFixed(2);
4$('#total_amount').val(totalAmount);
5//@sujay