체크박스 관련

체크박스 관련

QA

체크박스 관련

답변 1

본문

name="chk_all" 인 체크박스 체크할때 다른것들이 일괄체크가 되질 않네요. 어디가 잘못됐을까요????


<link href="iosCheckbox.css" rel="stylesheet" type="text/css">

<input type="checkbox" name="chk_all" class="ios" value="1"  id="chk_all"> check all <br>
<input type="checkbox" name="agree" class="ios"/>
<input type="checkbox" name="agree" class="ios" />

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="iosCheckbox.js"></script>
<script>
$(document).ready(function(){
    jQuery(function($){
        // 모두선택
        $("input[name=chk_all]").click(function() {
            if ($(this).prop('checked')) {
                $("input[name^=agree]").prop('checked', true);
            } else {
                $("input[name^=agree]").prop("checked", false);
            }
        });
    });
    $(".ios").iosCheckbox();
});
</script>

이 질문에 댓글 쓰기 :

답변 1

참고만 해 보새요.

 

<script>
$(function($){
// 모두선택
$("input[name=chk_all]").on('click', function() {
if($(this).prop('checked')) {
$("input[name^=agree]").prop('checked', true);
}else{
$("input[name^=agree]").prop("checked", false);
}
});

$(".ios").iosCheckbox();
});
</script>

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
  • 질문이 없습니다.
전체 0
© SIRSOFT
현재 페이지 제일 처음으로