저는 JQuery에 초보자입니다. 나는 테이블을 가지고있다. 내 테이블에 두 개의 플러그인을 적용하고 싶습니다. Tablesorter 및 tablescroll 플러그인을 사용합니다. 내가 포함했다JQuery 플러그인에서 오류를 발생했습니다.
자바 스크립트 파일 : 나는 내 HTML의 헤드 섹션에 아래 코드를 포함하면
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="js/jquery.tablescroll.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
, 아무것도 작동하지 않습니다. 그리고 닫는 본문 태그 바로 뒤에 파일 끝 부분에 포함 시키면 테이블 스크롤 기능이 작동합니다. 테이블 정렬이 전혀 작동하지 않습니다.
Uncaught TypeError: undefined is not a function
내 테이블 태그는 간단하다 :
<script type="text/javascript">
jQuery(document).ready(function($)
{
$('#showconnections').tableScroll({height:500});
$('#showconnections').tablesorter();
});
</script>
나는 오류가 주어진 다음, 콘솔에서 확인.
<table id="myTable" cellspacing="0" class="table table-bordered table-responsive table-striped tablesorter" border="1">
<thead>
<tr>
<th rowspan="2">city id</th>
<th rowspan="2">state name</th>
<th rowspan="2">cityname</th>
<th rowspan="2">state code</th>
<th rowspan="2">zip code</th>
</tr>
</thead>
<tbody>
<tr>
<td>fdfd</td>
<td>ddffd</td>
<td>dffd</td>
<td>dfdf</td>
<td>fgfd</td>
</tr>
</tbody>
</table>
NB : 테이블 태그의 구조는 상기에 주어진다. 데이터는 더미입니다. 내 테이블에 여러 행이 들어 있습니다.
'jquery-latest.js'에 한 번, Google CDN에서 한 번, jQuery를 두 번 포함합니다. 그 중 하나를 삭제하고 jQuery가 항상 페이지에 포함 된 첫 번째 스크립트인지 확인하는 것이 좋습니다. –
나는 그것을 시험해 보았다. 테이블 정렬이 작동하지 않습니다. 잡히지 않은 TypeError : undefined는 함수가 아닙니다 @Rory McCrossan –
@RoryMcCrossan 답글로 의견을 추가하십시오, 나는 그것을 upvote거야! @TheJoker'js/jquery-latest.js'와'https : // ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'는 모두 jQuery의 복사본입니다. 하나 제거하십시오! – Mottie