I'm using the excellent Datatables with Vedmack's YADCF plugin, which is working great. The only thing I can't figure out is ...
How do I switch focus to a specific YADCF filter text input box on page load? I've tried the following in and outside of document.ready, but neither work:
$('#yadcf-filter--Table-7').ready(function() {
$('#yadcf-filter--Table-7').focus();
});
... and ...
$('#yadcf-filter--Table-7').load(function() {
$('#yadcf-filter--Table-7').focus();
});
The input box doesn't appear for about 2 seconds after page load and the ID is appended by the plugin, which I assume is why I'm struggling to get it to work.
Any ideas, please?
Thanks!
Sorry - ignore this, the following works fine, I'd just made a daft mistake earlier on:
$(document).ready(function() {
yadcf.init(Table, [
etc, etc...
];
$('#yadcf-filter--Table-7').ready(function() {
$('#yadcf-filter--Table-7').focus();
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.