웹자료
jquery 배열로 된 변수일때 체크박스 전체체크 해제
꿀식사
2017. 3. 27. 10:11
체크박스 전체체크 버튼 <input type="checkbox" id="chkAll" title="Check All" />
체크박스 <input type="checkbox" name="chkbox[]" />
<script type="text/javascript" src="/js/jquery/jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#chkAll").click(function(){
if($('#chkAll').is(':checked')){
$("input[name='chkbox[]']").each(function() {
$(this).attr('checked', 'checked');
})
}else{
$("input[name='chkbox[]']").each(function() {
$(this).attr('checked', '');
})
}
});
});
</script>