Set focus to field in dynamically loaded DIV
The load() function is an asynchronous function. You should set the focus after the load() call finishes, that is in the callback function of load(), because otherwise the element you are referring to by #header, does not yet exist. For example: $(“#display”).load(“?control=msgs”, {}, function() { $(‘#header’).focus(); }); I had issues myself even with this solution, … Read more