Set focus on filter input
Set focus on filter input
justSteve
Posts: 49Questions: 8Answers: 1
As discussed at: https://datatables.net/forums/discussion/6401/change-the-word-search-to-filter -- perhaps needs to be updated. Out of the box my filter input's markup looks like
<div id="ordersTable_filter" class="dataTables_filter">
<label>
Search:
<input class="" type="search" placeholder="" aria-controls="ordersTable">
</label>
</div>
I've tried both:
$('#ordersTable_filter input:search').focus(); // tosses error
and:
$('#ordersTable_filter input:text').focus(); // doesn't work
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hello,
only use input
Fiddle:
http://live.datatables.net/hoduyawo/1/edit
The first one would need to be:
There is no
:search
pseudo class.However, as @btree says, just simplify it and drop the pseudo class altogether - it isn't needed as there are no other input elements in that div.
Allan
Perfect -- mny thx!