jQuery遍历表格并求和


所求和为第三列和第四列乘积的总和

$("tr td:nth-child(3)").each(function(i){
var abc=parseInt($(this).html().replace("$",""))
//alert(abc);
$("tr td:nth-child(4)").each(function(j){
if(i==j){
third+=abc*parseInt($(this).html());

}

})


$(".costs").html('total costs:'+third+"$");
});