[jQuery]전체 선택

728x90
$(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>

반응형

'Programming > Javascript' 카테고리의 다른 글

filter  (0) 2020.02.28
웹에서 서명하기, signature_pad.js  (0) 2020.02.28
[jQuery]복사, 붙여넣기, 잘라내기 안 되게...  (0) 2020.02.27
[jQuery]세 자리마다 콤마 찍기 number format  (0) 2020.02.17
카운트다운  (0) 2020.02.15

이 글을 공유하기

댓글

Designed by JB FACTORY