jQuery tablesorter doesnt work for me

323 views Asked by At

I'm trying to learn jQuery and tablesorter (http://mottie.github.io/tablesorter/docs/) caught my eye. I wanted to see if I can use this. I am having problems just having it sort in the first place.

this is my HTML code, and it just doesn't sort for me. Help a beginner out?

 $(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>[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>

1

There are 1 answers

1
gws000 On

I copied your code into a test (Here) and it seems to behave normally.

<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>

Have you verified the paths of all the referenced libraries you are using? If you are an absolute beginner with tablesorter, the examples in the master library might be handy (Here).