首页 > Web开发 > 详细

(转)jquery合并单元格

时间:2019-01-15 18:47:47      阅读:156      评论:0      收藏:0      [点我收藏+]

文章原文: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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!