Focus on input/filter
Focus on input/filter
[Deleted User]
Posts: 0Questions: 5Answers: 0
I need to put the focus on the filter input field after datatable is drawn. I'll try several notations, like [code]$("#mytablename_filter:input").focus();[/code]but nothing works. Can someone give me a hint, please?
This discussion has been closed.
Replies
no ideas?
[code]
$("#mytableid_filter input").focus();
[/code]
Do that after DataTables has been initialised and it should work okay.
Allan
That was not the point:
[code]$("#mytableid_filter input").focus();[/code]
works well, as long as not another language is in use.
[code]
$(document).ready(function() {
$('#mytableid').dataTable( {
"oLanguage": {"sUrl": "de_DE.txt"},
"sAjaxSource": "myajax.php"
} );
$("#mytableid_filter input").focus();
});
[/code]
does not work (in my case).
de_DE.txt:
[code]
...
"sSearch": "Filter",
...
[/code]
Allan
[code]...
"fnInitComplete": function() {
$("#mytableid_filter input").focus();
}
...[/code]
works fine with with German language.