How to sum the column for auto generated row in footer for column 3.
<table id="tblItems" class="table table-responsive">
<thead>
<tr>
<th>Val1</th>
<th>Val2</th>
<th >Val3</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="text/javascript">
function Add() {
AddRow($("#txtVal1").val(), $("#txtVal2").val(), $("#txtVal3").val());
$("#txtVal1").val("");
$("#txtVal2").val("");
$("#txtVal3").val("");
};
function AddRow(name, qty, price) {
var tBody = $("#tblItems > TBODY")[0];
//Add Row.
row = tBody.insertRow(-1);
//Add Name cell.
var cell = $(row.insertCell(-1));
cell.html(name);
//Add Qty cell.
cell = $(row.insertCell(-1));
cell.html(qty);
//Add Price cell.
cell = $(row.insertCell(-1));
cell.html(price);
//Add Amount cell.
cell = $(row.insertCell(-1));
cell.html(parseInt(qty) * parseInt(price));
//Add Button cell.
cell = $(row.insertCell(-1));
var btnRemove = $("<a>Remove</a>");
btnRemove.attr("href", "#");
btnRemove.attr("onclick", "Remove(this);");
cell.append(btnRemove);
};
function Remove(button) {
var row = $(button).closest("TR");
var name = $("TD", row).eq(0).html();
if (confirm("Do you want to delete item : " + name)) {
var table = $("#tblItems")[0];
table.deleteRow(row[0].rowIndex);
}
};