我正在关注tablesorter提供的演示示例。我已经确认jquery工作正常。但是,我尝试重新创建演示,jquery.tablesorter.js根本没有产生任何变化。输出仍然是纯HTML文本表。
我错过了什么?
myTable.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../js/myTable.js"></script>
<script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="../js/__jquery.tablesorter/jquery.tablesorter.js"></script>
</head>
<body>
<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>
</body>
</html>
myTable.js
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
答案 0 :(得分:2)
在js / myTable.js之前移动jQuery和tablesorter:
<head>
<script type="text/javascript" src="../js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="../js/__jquery.tablesorter/jquery.tablesorter.js"></script>
<script type="text/javascript" src="../js/myTable.js"></script>
</head>