I need a help. In my project i have a html table i need the total cell sum and get the result to grand total textbox here my project is in asp.net mvc. I have also attached my source code below
<script type="text/javascript">    
    function Add() {
        if ($.trim($("#txtRate").val()) == 0 || "") {
            alert("No Data Found");
        }
        else {
            AddRow($("#ddlItems option:selected").text(), $("#txtRate").val(), $("#txtSgst").val(), $("#txtCgst").val(), $("#txtdisc").val(), $("#txtdisamt").val(), $("#txtCgstamt").val(), $("#txtSgstamt").val(), $("#txtamt").val(), $("#txttotal").val());          
            $("#dditemlist").val("0");
            $("#txtRate").val("");
            $("#txtSgst").val("");
            $("#txtCgst").val("");
            $("#txtqty").val("");
            $("#txtdisc").val("");
            $("#txtdisamt").val("");
            $("#txtCgstamt").val("");
            $("#txtSgstamt").val("");
            $("#txtamt").val("");
            $("#txttotal").val("");
        };
        function AddRow(items, rate, sgst, cgst, qty, dis, disamt, cgstamt, sgstamt, amt, total) {
            var tBody = $("#tblItems > TBODY")[0];
            //Add Row.
            row = tBody.insertRow(-1);
            //Add Name cell.
            var cell = $(row.insertCell(-1));
            cell.html(items);
            //Add Qty cell.
            cell = $(row.insertCell(-1));
            cell.html(rate);
            //Add Price cell.
            cell = $(row.insertCell(-1));
            cell.html(sgst);
            //Add Sgst cell.
            cell = $(row.insertCell(-1));
            cell.html(sgst);
            //Add Cgst cell.
            cell = $(row.insertCell(-1));
            cell.html(cgst);
            //Add Qty cell.
            cell = $(row.insertCell(-1));
            cell.html(qty);
            //Add Dis cell.
            cell = $(row.insertCell(-1));
            cell.html(dis);
            //Add Disamt cell.
            cell = $(row.insertCell(-1));
            cell.html(disamt);
            //Add Cgstamt cell.
            cell = $(row.insertCell(-1));
            cell.html(cgstamt);
            //Add Sgstamt cell.
            cell = $(row.insertCell(-1));
            cell.html(sgstamt);
            //Add Amount cell.
            cell = $(row.insertCell(-1));
            cell.html(amt);
            //Add Total cell.
            cell = $(row.insertCell(-1));
            cell.html(total);
           
            calculateSum();
            
            //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);
            }
        };
        function calculateSum() {
           var sum=0;
            var table = document.getElementById("tblItems");
            var name = $("TD", row).eq(10).html();
           
            for(var i=0;i<table.rows.length;i++)
            {
                sum += $("TD", row).eq(10).html();
            }
            document.getElementById('txtsubtotal').value = sum;
        };
</script>