Reddy Reddy -4 years ago 195 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


Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download