Reddy Reddy - 1 month ago 20x Question

Auto focus on search box of jQuery DataTable

I am unable to find a way to auto focus on jQuery Datatable's Search Box on page load.

The problem here is that this Text box is not given a ID and so i'm unable to access it.

Can someone help me with this issue.

An example of Datatable is at



You can do this with jquery:

$(function() {
  $('#datatabelID [type="search"]').focus()


$('div.dataTables_filter input').focus()

Just use your datatable Id with the above selector, and you are bale to access the search textbox.