Jquery Table Sort Example - Jquery
How to sort table in jquery?
Snippet Code
Jquery tablesorter is used to sort the data of a table. By clicking the column heading the table becomes sortable. The jquery.tablesorter.min.js file plugin is used to sort the values in a table.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src='http://tablesorter.com/__jquery.tablesorter.min.js'></script>
<script type='text/javascript'>
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
</script>
<table id="myTable" class="tablesorter" border=2 cellspacing=5 cellpadding=5>
<thead>
<tr>
<th>Last Name <></th>
<th>First Name <></th>
<th>Email <></th>
<th>Mobile <></th>
</tr>
</thead>
<tbody>
<tr>
<td>Smith</td>
<td>John</td>
<td>jsmith@gmail.com</td>
<td>8878987874</td>
</tr>
<tr>
<td>Bach</td>
<td>Frank</td>
<td>fbach@yahoo.com</td>
<td>9687457890</td>
</tr>
<tr>
<td>Doe</td>
<td>Jason</td>
<td>jdoe@hotmail.com</td>
<td>7845789600</td>
</tr>
</tbody>
</table>
Tags