[jQuery] 유동적인 테이블 셀병합 - rowspan
위와 같이 소속에 같은 데이터가 있을 경우 하나의 셀로 병합해주는 코드다. $(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(); } }); }
카테고리 없음
2018. 9. 11. 12:30