Jquery Tablesorter not working! What's wrong with that?

TwentyLe picture TwentyLe · Mar 30, 2013 · Viewed 20.8k times · Source

I'm new to Jquery and I'm trying to use Jquery Tablesorter plugin and I've tested it in a simple html file as below but it is not working. All I have seen in browser is only a plain table with no sorting, none clickable header, it doesn't look like what I seen on Jquery Tablesorter home page. I don't know what's wrong with my html. I have placed 2 jquery files in same folder with this html file. Please advise!

<html>
<head>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script> 
<script type="text/javascript">
$(document).ready(function() 
    { 
         $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); 
    } 
); 
</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>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.jsmith.com</td> 
</tr> 
<tr> 
    <td>Bach</td> 
    <td>Frank</td> 
    <td>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.frank.com</td> 
</tr> 
<tr> 
    <td>Doe</td> 
    <td>Jason</td> 
    <td>[email protected]</td> 
    <td>$100.00</td> 
    <td>http://www.jdoe.com</td> 
</tr> 
<tr> 
    <td>Conway</td> 
    <td>Tim</td> 
    <td>[email protected]</td> 
    <td>$50.00</td> 
    <td>http://www.timconway.com</td> 
</tr> 
</tbody> 
</table> 
</body>
</html>

Answer

Dead Man picture Dead Man · Mar 30, 2013

Here's the working fiddle link. You forgot to add the tablesorter js and tablesorter css which I added in external resources in jsfiddle. You can check it.

http://jsfiddle.net/BKgue/2/