i have a problem with the code below, I want to sum alla input values for a tr and that works good except that it show the row values on all rows instead of the changed one. Code below:
$(".txtMult input").keyup(multInputs);
function getNum($val) {
if (isNaN($val)) {
return 0;
} else {
return $val;
}
}
function multInputs() {
var mult = 0;
var $total = 0;
// for each row:
$("tr.txtMult").each(function () {
var $total = 0;
$("input.val").each(function () {
// get the values from this row:
$total = +parseFloat($total)+getNum(parseFloat($(this).val()));
});
$('.multTotal',this).text($total);
});
}
any suggestions ?
Example on JSfiddle