테스트 사이트 - 개발 중인 베타 버전입니다

자바스크립트 전체 체크 문의드려요.... 채택완료

지음ad 7년 전 조회 1,728

</p>

<p>            <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></p>

<p>            <script></p>

<p>                $("#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);

                    }

                }); </p>

<p>            </script></p>

<p>

 

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

                                                                                                                           

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

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

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트

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

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

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인