表格中同一列的相同元素合并单元格

列的css class为class_name

	   var that;
		$(".class_name").each(function(){
			if ($(this).text() == $(that).text()) {
				rowspan = $(that).attr("rowSpan");
				if (rowspan == undefined) {
					$(that).attr("rowSpan", 1);   
					rowspan = $(that).attr("rowSpan");   
				}
				rowspan = Number(rowspan) + 1;
				$(that).attr("rowSpan", rowspan); // do your action for the colspan cell here
				$(this).remove(); // .remove(); // do your action for the old cell here
		    } else {
				that = this;
		    }
		});

你可能感兴趣的:(JavaScript,css)