簡體   English   中英

jQuery tablesorter對我不起作用

[英]jQuery tablesorter doesnt work for me

我正在嘗試學習jQuery和tablesorter( http://mottie.github.io/tablesorter/docs/ )引起了我的注意。 我想看看是否可以使用它。 我在將其放在第一位時遇到了問題。

這是我的HTML代碼,但對我來說卻沒有排序。 幫助初學者嗎?

  $(function() { $("#myTable").tablesorter({ sortList: [ [0, 0], [1, 0] ] }); }); 
 <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.22.1/css/theme.default.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.22.1/js/jquery.tablesorter.widgets.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.22.1/js/jquery.tablesorter.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <table id="myTable" class="tablesorter"> <thead> <tr> <th>Last Name</th> <th>First Name</th> <th>Email</th> <th>Due</th> <th>Web Site</th> </tr> </thead> <tbody> <tr> <td>Smith</td> <td>John</td> <td>jsmith@gmail.com</td> <td>$50.00</td> <td>http://www.jsmith.com</td> </tr> <tr> <td>Bach</td> <td>Frank</td> <td>fbach@yahoo.com</td> <td>$50.00</td> <td>http://www.frank.com</td> </tr> <tr> <td>Doe</td> <td>Jason</td> <td>jdoe@hotmail.com</td> <td>$100.00</td> <td>http://www.jdoe.com</td> </tr> <tr> <td>Conway</td> <td>Tim</td> <td>tconway@earthlink.net</td> <td>$50.00</td> <td>http://www.timconway.com</td> </tr> </tbody> </table> 

我將您的代碼復制到一個測試中( Here ),它似乎正常運行。

<script type="text/javascript" src="js/tablesorter/js/jQuery/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/tablesorter/js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/tablesorter/js/jquery.tablesorter.widgets.js"></script>

您是否已驗證正在使用的所有引用庫的路徑? 如果您絕對是tablesorter的初學者,那么master庫中的示例可能會很方便( Here )。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM