[jQuery]전체 선택
Javascript 2020. 2. 27. 15:15
반응형
$(function() {
$("#check-all").on("click", function(e) {
e.preventDefault();
$(".chks").trigger("click");
});
});
<table>
<tr>
<th><a href="#" id="check-all">check all</a></th>
</tr>
<tr>
<td><input type="checkbox" class="chks"></td>
</tr>
<tr>
<td><input type="checkbox" class="chks"></td>
</tr>
<tr>
<td><input type="checkbox" class="chks"></td>
</tr>
</table>
특별한 코드는 없습니다.
그저 전체 선택이라는 것을 클릭할 때마다 chks라는 클래스를 가진 애들을 클릭하게 trigger를 걸었을 뿐...
반응형
'Javascript' 카테고리의 다른 글
filter (0) | 2020.02.28 |
---|---|
웹에서 서명하기, signature_pad.js (0) | 2020.02.28 |
[jQuery]전체 선택 (0) | 2020.02.27 |
[jQuery]복사, 붙여넣기, 잘라내기 안 되게... (0) | 2020.02.27 |
[jQuery]세 자리마다 콤마 찍기 number format (0) | 2020.02.17 |
카운트다운 (0) | 2020.02.15 |