基于此
https://jsfiddle.net/tzw4mkL2/
我需要在每个桌子后面工作
表总表总计
示例:在这种情况下,不要工作
<div class='force'>
1
</div>
<div class='force'>
2
</div>
<div class='force'>
3
</div>
total:
<div id='total_forces'>
</div>
<div class='force'>
1
</div>
<div class='force'>
2
</div>
<div class='force'>
3
</div>
total:
<div id='total_forces'>
</div>
必须在它们之间插入一些东西
谢谢
var total=0;
$.each($(".force"),function(){
total+=parseInt($(this).text());
if(!$(this).next('div').hasClass('force')){
$(this).next('div').text(total);
total=0;
}
})