I am trying to autofocus every first element of modal that is triggered by datatable-alteditor. For better understanding, here is the Datatable example. When I click on Add button I need name
element field to focus. Here is the EXAMPLE-HTML and EXAMPLE-JS
I have gone through its Github documentation but couldn't find any example for autofocus
. I have tried to add autofocus
through column options object by setting it true/false and tried to trigger through script. But nothing worked out me. Kindly please help on this. Thanks in advance.
Here is the jsfiddle that reproduces the issue.
I was able to sort though your code and add this. It feels like a bit of a hack but it does work from what I can tell
setTimeout(()=>{
$(selector).find('input,select').not(':disabled,[readonly]').first().focus();
}, 500);
See it in action here: https://jsfiddle.net/g29b6kep/
What I added is around line #400