文章原文:https://blog.csdn.net/qq422431474/article/details/53318374
//合并单元格 ???jQuery.fn.rowspan = function (colIdx) { ???????return this.each(function () { ???????????var that, rowspan; ???????????$(‘tr‘, this).each(function () { ???????????????$(‘td:eq(‘ + colIdx + ‘)‘, this).filter(‘:visible‘).each(function () { ???????????????????console.log(1) ???????????????????if (that != null && $(this).html() == $(that).html()) { ???????????????????????rowspan = $(that).attr("rowspan"); ???????????????????????if (rowspan == undefined) { ???????????????????????????$(that).attr("rowspan", 1); ???????????????????????????rowspan = $(that).attr("rowspan"); ???????????????????????} ???????????????????????rowspan = Number(rowspan) + 1; ???????????????????????$(that).attr("rowspan", rowspan); ???????????????????????$(this).hide(); ???????????????????} else { ???????????????????????that = this; ???????????????????} ???????????????}); ???????????}); ???????}); ???}
(转)jquery合并单元格
原文地址:https://www.cnblogs.com/ViokingJava/p/10273578.html