체크박스 관련 채택완료
name="chk_all" 인 체크박스 체크할때 다른것들이 일괄체크가 되질 않네요. 어디가 잘못됐을까요????
Copy
<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개
6년 전
참고만 해 보새요.
<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>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인