Jquery的table的合并行

来源:互联网 发布:字符串拼接函数 js 编辑:程序博客网 时间:2024/05/20 02:27
var $lastCell = null;
    var mergeCellSelector = ".c-date";
    $("#scoreboard tbody td.c-date").each(function () {


if ($lastCell && $lastCell.text() == $(this).text()) {


            $lastCell.closest("tr").children(mergeCellSelector)
            .each(function () {
                this.rowSpan = (this.rowSpan || 1) + 1;
            });


            $(this).closest("tr").children(mergeCellSelector).remove();
        }
        else
            $lastCell = $(this);

    });

scoreboard  是table.id

c-date是要合并的td的class 

这个td也是要合并的主key



0 0
原创粉丝点击