티스토리 뷰
위와 같이 소속에 같은 데이터가 있을 경우 하나의 셀로 병합해주는 코드다.
$(document).ready(function(e){
genRowspan("td 클래스명");
});
function genRowspan(className){
$("." + className).each(function() {
var rows = $("." + className + ":contains('" + $(this).text() + "')");
if (rows.length > 1) {
rows.eq(0).attr("rowspan", rows.length);
rows.not(":eq(0)").remove();
}
});
}
댓글
rowspan.html