[jQuery] 체크박스 전체 선택 제이쿼리
페이지 정보
본문
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>check_all demo</title>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
</head>
<body>
<div id="checkall">
<input type="checkbox" name="check_all"> 전체선택
</div>
<ol>
<li><input type="checkbox" name="wr_1" class="id_row" value="1">
<li><input type="checkbox" name="wr_2" class="id_row" value="2">
<li><input type="checkbox" name="wr_3" class="id_row" value="3">
<li><input type="checkbox" name="wr_4" class="id_row" value="4">
<li><input type="checkbox" name="wr_5" class="id_row" value="5">
<li><input type="checkbox" name="wr_6" class="id_row" value="6">
<li><input type="checkbox" name="wr_7" class="id_row" value="7">
</ol>
<script>
$(document).on('change','input[name="check_all"]',function() {
$('.id_row').prop("checked" , this.checked);
});
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>check_all demo</title>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
</head>
<body>
<div id="checkall">
<input type="checkbox" name="check_all"> 전체선택
</div>
<ol>
<li><input type="checkbox" name="wr_1" class="id_row" value="1">
<li><input type="checkbox" name="wr_2" class="id_row" value="2">
<li><input type="checkbox" name="wr_3" class="id_row" value="3">
<li><input type="checkbox" name="wr_4" class="id_row" value="4">
<li><input type="checkbox" name="wr_5" class="id_row" value="5">
<li><input type="checkbox" name="wr_6" class="id_row" value="6">
<li><input type="checkbox" name="wr_7" class="id_row" value="7">
</ol>
<script>
$(document).on('change','input[name="check_all"]',function() {
$('.id_row').prop("checked" , this.checked);
});
</script>
</body>
</html>
추천0
관련링크
-
http://{url}/tip/check_all.html
1589회 연결
댓글목록
등록된 댓글이 없습니다.