如何使用javascript计算动态行和单元格的和值

如何使用javascript计算动态行和单元格的和值,javascript,jquery,Javascript,Jquery,它的工作良好时,已经值显示,但我想当改变单元格中的值总和值也改变请帮助我 $(".prop_inc_table tr:not(:first,:last) td:last-child").text(function(){ var t = 0; $(this).prevAll().each(function(){ t += parseInt( $(this).text(), 10 ) || 0

它的工作良好时,已经值显示,但我想当改变单元格中的值总和值也改变请帮助我

$(".prop_inc_table tr:not(:first,:last)  td:last-child").text(function(){
                var t = 0;
                $(this).prevAll().each(function(){ 
                    t += parseInt( $(this).text(), 10 ) || 0;
                });
                return t;
            });

            $(".prop_inc_table tr:last td:not(:first,:nth-child(2),:last)").text(function(i){
                var t = 0;
                $(this).parent().prevAll().find("td:nth-child("+(i + 2)+")").each(function(){
                    t += parseInt( $(this).text(), 10 ) || 0;
                });
                return t;
            }); 

也许这个答案可以启发你,