[jQuery] row clone and calculation
Hi,
I have a table with input fields (array of them)...i can add new rows
through clone...the problem is that i would like to calculate the
numbers in the fields and display the sum at the end (both row sum and
final sum) and i don't know how.
Here's what i got:
function calc(){
var price = $("input[@name='price[]']").val();
var qty = $("input[@name='qty[]']").val();
res = price * qty;
$("input[@name='row_sum[]']").val(res);
var sum = $("input:disabled").sum();
$(".sum").text(sum);
}
The function is called on input keyup. Row sum is shown in the
disabled input...
Obviously this doesn't work when i add a row...it only works for the
first row which is hardcoded...
Thanks in advance!