1$(document).ready(function() {
2 // Setup - add a text input to each footer cell
3 $('#example thead tr').clone(true).appendTo( '#example thead' );
4 $('#example thead tr:eq(1) th').each( function (i) {
5 var title = $(this).text();
6 $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
7
8 $( 'input', this ).on( 'keyup change', function () {
9 if ( table.column(i).search() !== this.value ) {
10 table
11 .column(i)
12 .search( this.value )
13 .draw();
14 }
15 } );
16 } );
17
18 var table = $('#example').DataTable( {
19 orderCellsTop: true,
20 fixedHeader: true
21 } );
22} );
23