How to calculating column and row sum in html table using jquery

后端 未结 1 412
心在旅途
心在旅途 2021-01-24 08:46

I want to calculate the total of rows and columns in HTML Table using jquery I tried but the total column is not calculating can anybody help me.Below is my code:



        
1条回答
  •  一向
    一向 (楼主)
    2021-01-24 09:35

    if you want the total in the right bottom cell check this
    Fiddle i add this code to your jquery code

                var count=0
                for(i=1;i<$('tr').length;i++){
                    var trs=parseInt($('tr:eq('+i+')').find('td:last').text())
                    count+=trs
                }
                $(".printer-type tr:last td:last").text(count)
    

    If this solution does not suit your needs, i apologize for making you lose time.

    0 讨论(0)
提交回复
热议问题