자바스크립트 전체 체크 문의드려요....

자바스크립트 전체 체크 문의드려요....

QA

자바스크립트 전체 체크 문의드려요....

답변 1

본문


            <table id="show">
                    <thead>
                        <tr id="non_col">
                            <th scope="col" class="col_0"></th>    
                            <th scope="col" id="chk">
                                <label for="chkall" class="sound_only"></label>
                                <input type="checkbox" name="checkAll" value="1" id="checkAll">
                            </th>
                            <th scope="col" class="col_1">번호</th>    
                            <th scope="col" class="col_1">날짜</th>
                            <th scope="col" class="col_1">등록일</th>
                        </tr>
                    </thead>
            </table>
            <script>
                $("#checkAll").click(function(){
                    if($(this).is(":checked"))
                    { 
                        $("input[id^=chk]:checkbox:not(:disabled)").prop("checked", true);
                    }
                    else 
                    { 
                    // html id가 "chk_"으로 시작하는 모든 체크박스의 checked 값을 false로 변경한다.
                        $("input[id^=chk]:checkbox:not(:disabled)").prop("checked", false);
                    }
                }); 
            </script>

 

위 코드로 전체 체크를 사용하고 있는데 이상하게

                            <th scope="col" id="chk">
                                <label for="chkall" class="sound_only"></label>
                                <input type="checkbox" name="checkAll" value="1" id="checkAll">
                            </th>

이 부분이 테이블 밖으로 빠지면 전체 체크가 되고

테이블 안으로 들어오면 전체 체크가 안되네요;;

이 질문에 댓글 쓰기 :

답변 1

그누보드 기본 게시판의 list.skin.php 보시면 기본적으로 현재게시물 전체를 체크하는 부분이 있습니다.

그것 참고하시거나 그것과 중복되고 있는것이 있는건 아닌지 살펴보세요.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 125,873
© SIRSOFT
현재 페이지 제일 처음으로