In my Page there are multiple jquery datatbles.I want to programmatically reset search textfield inside one of the Jquery Datatable.
var dtTaskEmployee= $('#tblEmployee').DataTable({});
$('#modalEmployeeDetails').on('hidden.bs.modal', function () {
$('input[type=search]').val('');
dtTaskEmployee.search('').draw();
})
But this one cleares all the search fields inside all the datatble. I want to clear the search input field inside dtTaskEmployee. Can anyone help on this
CodePudding user response:
$('input[type=search]').val('');
will clear all search fields so you want to limit this to #tblEmployee
only.
var dtTaskEmployee= $('#tblEmployee').DataTable({});
$('#modalEmployeeDetails').on('hidden.bs.modal', function () {
$('#tblEmployee_filter input[type=search]').val('');
dtTaskEmployee.search('').draw();
})