Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: jsmecham-master
Fetching contributors…

Cannot retrieve contributors at this time

110 lines (98 sloc) 1.994 kB
<style type="text/css">
body {
font: normal 14px/21px Arial, serif;
.example {
float: left;
width: 40%;
margin: 5%;
table {
font-size: 1em;
border-collapse: collapse;
margin: 0 auto
table, th, td {
border: 1px solid #999;
padding: 8px 16px;
text-align: left;
th {
background: #f4f4f4;
cursor: pointer;
th.sorted {
background: #d4d4d4;
th.sorted.ascending:after {
content: " \2191";
th.sorted.descending:after {
content: " \2193";
<div class="example ex-1">
<th>Date of Birth</th>
<th class="number">Age</th>
<td>Thom Yorke</td>
<td data-sort-value="2">October 7, 1968</td>
<td>Justin Vernon</td>
<td>Bon Iver</td>
<td data-sort-value="4">April 30, 1981</td>
<td>Paul McCartney</td>
<td>The Beatles</td>
<td data-sort-value="1">June 18, 1942</td>
<td>Sam Beam</td>
<td>Iron &amp; Wine</td>
<td data-sort-value="3">July 26, 1974</td>
<div class="example ex-2"></div>
<script src=""></script>
<script src="jquery.tablesort.js"></script>
<script type="text/javascript">
$(function() {
var table = $('<table></table>');
table.append('<thead><tr><th class="number">Number</th></tr></thead>');
var tbody = $('<tbody></tbody>');
for(var i = 0; i<100; i++) {
tbody.append('<tr><td>' + Math.floor(Math.random() * 100) + '</td></tr>');
$('thead th.number').data('sortBy', function(th, td, sorter) {
return parseInt(td.text(), 10);
Jump to Line
Something went wrong with that request. Please try again.