autofocus input search
autofocus input search
FlavioC16
Posts: 3Questions: 1Answers: 0
I would like to implement the "autofocus" function in the search field of my table, is this possible?
Answers
Check out this thread, especially Kevin's answer with the initComplete example.
Thanks for replying, but I'm new in the area, this type of code "initComplete" is not working in httm5 in conjunction with javascript
Please provide a link to your page or a test case showing the problem so we can help debug. You can update my below example.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Allan's solution in that thread works here:
http://live.datatables.net/puxafaga/1/edit
Kevin
Thanks for helping with this issue, the issue was resolved this way.
$(document).ready( function () {
var table = $('#dataTable').DataTable();
function foco(){
$('div.dataTables_filter input', table.table().container()).focus();
}
setTimeout(foco, 1)
});