I am trying to get tablesorter jQuery plugin to work, but haven’t been successful. Can anyone tell me what’s wrong?
I am receiving the “jquery loaded” alert box and triple checked the path to the tablesorter javascript file.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (jQuery) {
alert("jquery loadedd");
}
$("#foobar").tablesorter();
}
);
</script>
<title>Title</title>
</head>
<body>
<table id="foobar" class="tablesorter">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Nuno</td>
<td>20</td>
</tr>
</tbody>
</table>
</body>
</html>
i’m glad its working. The css through me for a quick loop at first too.
be sure to grab the authors css, but mainly the classes you need to style are .header, .headerSortDown, and .headerSortUp You can also customize the classes the table receives. I also found the tablesorters widget system to be nice and easily customizable. An example of a default widget is zebra striping.