Add DataTable with sort in html doc

I would like to create an simple table in html doc. The table exists but I cant order and operate with the table. I’m a noob in html and js.
My result:

enter image description here

<link rel="stylesheet" type="text/css" href="static/datatables.min.css"/>
<script type="text/javascript" src="static/datatables.min.js"></script>
<table id="example" class="display">
<thead>
  <tr><th>Person</th><th>Monthly pay</th></tr>
</thead>
<tbody>
  <tr><td>Jan Molby</td><td>12</td></tr>
  <tr><td>Steve Nicol</td><td>8</td></tr>
  <tr><td>Steve McMahon</td><td>9</td></tr>
  <tr><td>John Barnes</td><td>15</td></tr>
</tbody>
<tfoot>
  <tr><td>TOTAL</td><td>£45,000</td></tr>
</tfoot>
</table>
<script type="text/javascript">
  $(document).ready(function() {
      $('#example').dataTable();
  } );
</script>

36 thoughts on “Add DataTable with sort in html doc”

  1. 431831 598892Hello there, just became alert to your weblog through Google, and discovered that its truly informative. Im gonna watch out for brussels. I will appreciate if you continue this in future. A great deal of individuals will likely be benefited from your writing. Cheers! xrumer 238975

    Reply

Leave a Comment