2015-10-20
query 최신버전에는 removeAttr()로 "checked"를 삭제해 버리면 해당 속성 자체가 삭제 되버려 attr()로 "checked"를 해도 적용이 되지 않는다.
그래서 최신버전에는 prop()를 이용해야 한다.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$( function(){
	$('.chk_all').click(function(){
		if( $('.chk_all').prop('checked') )
		{
			$('.chk').prop('checked',true);
		}
		else
		{
			$('.chk').prop('checked',false);
		}
	});
});
</script>

<input type="checkbox" class="chk_all" name="chk_all" id="chk_all" value="1"><br><br>

<input type="checkbox" class="chk" name="chk1" id="chk1" value=""><br>
<input type="checkbox" class="chk" name="chk2" id="chk2" value=""><br>
<input type="checkbox" class="chk" name="chk3" id="chk3" value=""><br>
<input type="checkbox" class="chk" name="chk4" id="chk4" value=""><br>