Search box getting focus without me setting it
Search box getting focus without me setting it
I have a DataTable, loading from the server during $(document).ready. The page has a lot of content on it so when the page initally loads, the DataTable is below the bottom of the screen. For some reason, the search box gets focus even though there are a bunch of inputs above it on the page. So, this causes the page to scroll down to the DataTable just enough to have the Search Box on screen. There is no code to set the focus there. If I change the DOM and remove the "f", it doesn't scroll because it isn't there (obviously). I cannot figure out how it is doing this! What else can cause the search box to gain focus?
This question has an accepted answers - jump to answer
Answers
Hi @Kanth ,
By default, the initialisation doesn't set the focus on the search input, you can see that by trying the examples. I'm not sure how you can tell which script is causing - maybe try looking at the events on the page.
Hope that helps,
Colin
Thanks @Colin. As it turns out, there was a Custom User Control with a DataTable in it that was calling
on the initComplete. The browser, I suppose, just chose the latest one to focus on.