我正在尝试合并具有相同文本内容的8列中的单元格。 我可以在下面看到 - merging <td> rows in one column of html table,但这只能一次在1列上运行,当被告知循环遍历列时,它不起作用
关于如何对表中的所有列执行此操作的任何想法?
答案 0 :(得分:0)
你可以通过在&#34; tr&#34;中循环数据来实现这一点。级别并消除重复的条目,添加&#34; rowspan&#34;。
以下代码段对您有帮助,
$('#tblNewAttendees tr').each(function() {
//initate the rowcount here
$.each(this.cells, function(){
//use after function to append the cell
$(this).find('td').eq(0).after('<td rowspan=rowcount class="table-rowspan">==>fooo <== </td>');//instead of eq(0) use the number position you want to append
});
});
答案 1 :(得分:0)
好的解决了
而不是正常循环,我向后看,它有效:)