is there a simple way to remember the element which had focus on before the loading dialog is shown, and return the focus to that element?
There is a search button on the page which sends an ajax request on keyboard press to fetch the data from the server. On each ajax request the modal loading dialog shows (notice that it is jquery dialog), and after the response, the focus on the search element is lost, and I want it back.
Thanks.
Before you put the dialog up, you can save the location of the focus with this:
And, then after the dialog goes away, you can restore it: