您的位置:首页 > Web前端 > JavaScript

table表格合并封装的小插件

2017-02-07 15:09 921 查看
/**

 * 封装的一个JQuery小插件

 * @param {Object} colNo

 * @memberOf {TypeName} 

 * @return {TypeName} 

 */

jQuery.fn.rowspan = function(colNo) {  
return this.each(function(){ 
var that; 
$('tr', this).each(function(row){
$('td:eq('+ colNo +')', this).filter(':visible').each(function(col){ 
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; 

}); 
}); 
}); 

};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  插件 js