모지리도 정리한다.

#체크박스 선택하기 


간단하게 체크박스 선택하는 것에 대해 적겠습니다.


==html==



<table>
    <tr>
        <td><input type="checkbox" id="all" /></td>
        <td>내용</td>
    </tr>
    <tr>
        <td><input type="checkbox" name="a" /></td>
        <td>a</td>
    </tr>
    <tr>
        <td><input type="checkbox" name="a" /></td>
        <td>a</td>
    </tr>
</table>


==script==


$(document).ready(function(){ //실행함수 선언
    $("#all").click(function(){ // 상단에 id='all' 클릭
         if($("#all").prop("checked")){ // id='all'인 것을 체크했을 시, 즉 클릭한값이 체크값이면
              $("input[name=a]").prop("checked",true); // name찾아가 체크로 바꿈
          }else{
              $("input[name=a]").prop("checked",false);//아닐시, name찾아가 체크로 바꿈
        }
    })
})


* 여기서 dom형식은 어떤것으로해도 무관하다 ,  



참고 : 전체선택 및 삭제 SIte!