편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.
최신판 | 당신의 편집 | ||
4번째 줄: | 4번째 줄: | ||
==예시== | ==예시== | ||
< | <source lang='html'> | ||
<button id='btn-add-row'>행 추가하기</button> | <button id='btn-add-row'>행 추가하기</button> | ||
<button id='btn-delete-row'>행 삭제하기</button> | <button id='btn-delete-row'>행 삭제하기</button> | ||
14번째 줄: | 10번째 줄: | ||
<table id="mytable" border="1" cellspacing="0"> | <table id="mytable" border="1" cellspacing="0"> | ||
< | <tr> | ||
<th>제목</th> | |||
<th>일시</th> | |||
</tr> | |||
<tbody></tbody> | <tbody></tbody> | ||
</table> | </table> | ||
27번째 줄: | 21번째 줄: | ||
$('#btn-add-row').click(function() { | $('#btn-add-row').click(function() { | ||
var time = new Date().toLocaleTimeString(); | var time = new Date().toLocaleTimeString(); | ||
$('#mytable > tbody:last').append('<tr><td> | $('#mytable > tbody:last').append('<tr ><td rowspan=3>안녕ㅋ 친구들ㅋ </td><td>' + time + '</td></tr>'); | ||
}); | }); | ||
$('#btn-delete-row').click(function() { | $('#btn-delete-row').click(function() { | ||
$('#mytable > tbody | $('#mytable > tbody').remove(); | ||
}); | }); | ||
</script> | </script> | ||
</ | </source> | ||
<jsfiddle height='250'>jmnote/4pgfgvkx</jsfiddle> | |||
==같이 보기== | ==같이 보기== |