Reputation: 641
Sorry for coming with this dumb question, but I've been struggling for hours without success. My sample table is not being sorted. Both .js files are located in the same directory as the .shtml file itself.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
</script>
</head>
<body>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Test1</th>
<th>Test2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1622</td>
</tr>
<tr>
<td>2</td>
<td>2634</td>
</tr>
</tbody>
</table>
</body>
</html>
Upvotes: 2
Views: 5419
Reputation: 11269
Maybe you have bad copies of jquery and tablesorter? It appears to work fine for me using the actual versions of both jquery and tablesorter linked from their respective sites.
http://code.jquery.com/jquery-1.9.1.js
http://mottie.github.com/tablesorter/js/jquery.tablesorter.js
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
</script>
</head>
<body>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Test1</th>
<th>Test2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1622</td>
</tr>
<tr>
<td>2</td>
<td>2634</td>
</tr>
</tbody>
</table>
</body>
Upvotes: 4