jquery 的datatable 怎么用一个按钮代替它的搜索
网页链接1.10.16
<script>
var table = $('#datatable-responsive').DataTable();
$("#datatable-responsive_filter").css("display","none");
$("#datatable-responsive_filter").parent().append('<div class="input-group pull-right"><input id="searchforme" type="text" class="form-control" placeholder="Search for..."><button id="clearsearchinput" type="button" class="btn btn-round btn-xs" style="position:absolute; top:6px;right:42px; z-index:99;display:none;background-color:transparent;"><i class="fa fa-close"></i></button><span class="input-group-btn"><button id="go" class="btn btn-default" type="button"><i class="fa fa-search"></i></button></span></div>'); var table = $('#datatable-responsive').DataTable();
$(document).on( 'click','#go', function () {
table.search( $('#searchforme').val() ).draw();
} );
$(document).on( 'keyup','#searchforme', function () { if($(this).val().length > 0){
$('#clearsearchinput').css('display','block');
}else{
$('#clearsearchinput').css('display','none');
}
$(document).on( 'click','#clearsearchinput', function () {
$('#searchforme').val('');
$(this).css('display','none');
} );
} ); </script>