반응형
$(function(){
//전체선택 체크박스 클릭
$("#allCheck").click(function(){
//만약 전체 선택 체크박스가 체크된상태일경우
if($("#allCheck").prop("checked")) {
//해당화면에 전체 checkbox들을 체크해준다
$("input[type=checkbox]").prop("checked",true);
// 전체선택 체크박스가 해제된 경우
} else {
//해당화면에 모든 checkbox들의 체크를해제시킨다.
$("input[type=checkbox]").prop("checked",false);
}
})
})
<table>
<tr>
<td> 전체선택 : <input type="checkbox" id="allCheck"/> </td>
</tr>
<tr>
<td> <input type="checkbox"/> </td>
</tr>
<tr>
<td> <input type="checkbox"/> </td>
</tr>
<tr>
<td> <input type="checkbox"/> </td>
</tr>
<tr>
<td> <input type="checkbox"/> </td>
</tr>
<tr>
<td> <input type="checkbox"/> </td>
</tr>
</table>
반응형
'그때 그때 > JQUERY' 카테고리의 다른 글
progress bar (0) | 2020.11.16 |
---|---|
탭메뉴 /탭 여러개 (0) | 2020.10.07 |
mouse (0) | 2020.10.06 |
윈도우 팝업 / 레이어팝업 (0) | 2020.09.15 |
날짜선택 datepicker / daterangepicker (0) | 2020.09.14 |