jQuery traversing table and summed

The sum of the third and fourth columns of the sum of the product of

$("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+"$");
});

Guess you like

Origin www.cnblogs.com/F4natasy/p/10953470.html