javascript/jquery - 체크박스 모두 체크/ 모두 체크 해제

 

 

<table>
	<thead>
		<tr>
			<td>
				<input type="checkbox" class="chk_all"/>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				<td><input type="checkbox" class="chk_box" value="0"/></td>
			</td>
		</tr>
		<tr>
			<td>
				<td><input type="checkbox" class="chk_box" value="1"/></td>
			</td>
		</tr>
		<tr>
			<td>
				<td><input type="checkbox" class="chk_box" value="2"/></td>
			</td>
		</tr>
	</tbody>
</table>

<script language="javascript">
    $(document).ready(function(){
		 $(document).on("click",".chk_all",function(){
            $(".chk_box").prop("checked",$(this).prop("checked"));
        });
	});
</script>

+ 최근 게시물