I have a jsfiddle here.
In the fiddle there is a number of mark textboxes. Type a number in the text box and keep clicking on the add question button. You will see that the total marks remaining equals 10 but it doesn’t change. The number of marks remaining should change by subtracting each number in the appended row.
For example, if total marks remaining is 10 and you append four rows, each row containing marks of 1, then total marks remaining should be 6. (10 - 4 = 6.) But why is it not changing the number of marks remaining?
This is the function where it performs the calculation:
function calculateTotal()
{
var totalweight = totalmarks;
$("#qandatbl td.weight input").each(function (i, elm){
totalweight = totalweight - Number($(elm).val(), 10);
});
$("#total-weight").text(totalweight);
}
According to your jsfiddle you dont have inputs inside table#quandatbl.
Try change function to