<div class="table-wrap">
<table id="sortable">
<thead>
<tr>
<th onclick="sortTable(0)">Name ⇅</th>
<th onclick="sortTable(1)">Role ⇅</th>
<th onclick="sortTable(2)">Age ⇅</th>
</tr>
</thead>
<tbody>
<tr><td>Zack</td><td>Designer</td><td>24</td></tr>
<tr><td>Alice</td><td>Manager</td><td>30</td></tr>
<tr><td>John</td><td>Developer</td><td>28</td></tr>
<tr><td>Bob</td><td>Designer</td><td>22</td></tr>
</tbody>
</table>
</div>
Back to Snippets
Sortable HTML Table JS
Organize large datasets with this sortable table. Clicking any column header reorders the rows alphabetically or numerically, which makes finding specific information much faster for your users.
413