How to get the TD having the rowspan with value and split into individual td using jquery?

前端 未结 1 1765
粉色の甜心
粉色の甜心 2021-01-24 03:51

I have a table containing rowspan (Merged Rows), I need to split that merged rows into individuals and put the rowspan value in last td.

NOTE: In my cod

1条回答
  •  灰色年华
    2021-01-24 04:30

    Try this:

    $('table td').each(function() {
        var _parent_tr = $(this).parent();
        var rowspan = $(this).attr('rowspan');
        var rowspanVal = $(this).attr('rowspan');
        $(this).removeAttr('rowspan');
        if (rowspan && rowspan>1) {
         for(var i=1;i<=rowspan;i++){
         	_parent_tr.append(""+rowspanVal+"");
         }
        }
    });
    
    
    #     (Invested Assets) (Admitted Assets) Pasivos (Liabilities) Pasivos (Liabilities) Pasivos (Liabilities) Pasivos (Liabilities) Pasivos (Liabilities) Pasivos (Liabilities)
    (NAIC Code) ( Domestics Insurers)     (Aggregate Reserve for Life Contracts) (Reserve for Life Contract Claims) (Aggregate Reserve for Accident and Health Contract Claims) (Reserve for Accident and Health Contracts Claims) (Other Liabilities)** (Total Liabilities)

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