본문 바로가기

일하랴 공부하랴/JSP&JAVA

[jQuery] 손쉬운 전체 체크 박스.. 구현

jQuery - 전체 체크박스 구현


<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javaScript">

$(function(){

    $("#check_all").click(function(){

$(".chk").prop('checked', this.checked);

    });


}); 

</script>


<input type="checkbox"   id="check_all">


<input type="checkbox"  name="check_p1"  class="chk">

<input type="checkbox"  name="check_p2"  class="chk">

<input type="checkbox"  name="check_p3"  class="chk">