How to calculate sum of value in one column of all rows table table finding

后端 未结 3 851
你的背包
你的背包 2021-01-16 06:06

I have a table like this :

HTML:

');
  $(result).each(function(){
    $('table tr').last().append('')
  });
});

See example here: FIDDLE

提交回复
热议问题
value1value2value3&
3条回答
  •  日久生厌
    2021-01-16 07:03

    If you need create a new row dynamically with results, you can do it with append function:

    $(document).ready(function(){
      var result = [];
      $('table tr').each(function(){
        $('td', this).each(function(index, val){
            if(!result[index]) result[index] = 0;
          result[index] += parseInt($(val).text());
        });
      });
    
      $('table').append('
'+this+'