<script type="text/javascript"> $(document).ready( function () { $('#myTable tfoot td').each( function () { var title = $(this).text(); var index = $(this).index(); if ($(this).data('show')) { $(this).html('<input id="thead_th_'+index+'" type="text" placeholder="搜索 '+title+'" />'); }else{ $(this).html(''); } }); var opt={"language":{ "sProcessing":"處理中...", "sLengthMenu":"顯示 _MENU_ 項結果", "sZeroRecords":"沒有匹配結果", "sInfo":"顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", "sInfoEmpty":"顯示第 0 至 0 項結果,共 0 項", "sInfoFiltered":"(從 _MAX_ 項結果過濾)", "sSearch":"搜索:", "oPaginate":{ "sFirst":"首頁", "sPrevious":"上頁", "sNext":"下頁", "sLast":"尾頁" } } }; table = $('#myTable').DataTable(opt); <?=$datatable_order?> // Apply the search table.columns().every( function () { var that = this; $( 'input', this.footer() ).on( 'keyup change', function () { if ( that.search() !== this.value ) { that .search( this.value ) .draw(); } } ); }); } ); </script>