체크박스 관련

체크박스 관련

QA

체크박스 관련

본문

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>

답변을 작성하시기 전에 로그인 해주세요.
전체 223
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT