Home > Web Front-end > JS Tutorial > jquery merge cells with the same content (sample code)_jquery

jquery merge cells with the same content (sample code)_jquery

WBOY
Release: 2016-05-16 17:09:11
Original
875 people have browsed it

如下所示:

复制代码 代码如下:

 function _w_table_rowspan(_w_table_id,_w_table_colnum){
        _w_table_firsttd = "";
        _w_table_currenttd = "";
        _w_table_SpanNum = 0;
        _w_table_Obj = $(_w_table_id " tr td:nth-child(" _w_table_colnum ")");
        _w_table_Obj.each(function(i){
            if(i==0){
                _w_table_firsttd = $(this);
                _w_table_SpanNum = 1;
            }else{
                _w_table_currenttd = $(this);
                if(_w_table_firsttd.text()==_w_table_currenttd.text()){
                    _w_table_SpanNum ;
                    _w_table_currenttd.hide(); //remove();
                    _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);
                }else{
                    _w_table_firsttd = $(this);
                    _w_table_SpanNum = 1;
                }
            }
        });
    }   

    $(function(){   
    _w_table_rowspan("#_gvInformation",1);
    })
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template