DataTables

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.css">
<script src="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.js"></script>
<h3>jQuery DataTables: Numeric sorting</h3>
<a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a><hr>

<table id="example" class="display" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Name</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th>Name</th>
        </tr>
    </tfoot>
    <tbody>
        <tr><td>1 of 20</td></tr>
        <tr><td>2 of 20</td></tr>
        <tr><td>3 of 20</td></tr>
        <tr><td>4 of 20</td></tr>
        <tr><td>5 of 20</td></tr>
        <tr><td>6 of 20</td></tr>
        <tr><td>7 of 20</td></tr>
        <tr><td>8 of 20</td></tr>
        <tr><td>9 of 20</td></tr>
        <tr><td>10 of 20</td></tr>
        <tr><td>11 of 20</td></tr>
        <tr><td>12 of 20</td></tr>
        <tr><td>13 of 20</td></tr>
        <tr><td>14 of 20</td></tr>
        <tr><td>15 of 20</td></tr>
        <tr><td>16 of 20</td></tr>
        <tr><td>17 of 20</td></tr>
        <tr><td>18 of 20</td></tr>
        <tr><td>19 of 20</td></tr>
        <tr><td>20 of 20</td></tr>
    </tbody>
</table>

<hr><a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a>

JavaScript

$(document).ready(function (){
    var table = $('#example').DataTable({
       columnDefs: [
          { 
             targets: 0,
             type: 'num'
          }
       ]
    });
});