Category: jquery

Can’t focus input field in DOM loaded with ajax call

I have gone insane trying to figure out how to make this work. Code looks roughly like: function onDropDownChanged() { $(“#updatePanel”).load( “myUrl”, { id: $(“#myDropDown option:selected”).val() }, onPanelLoaded ); } function onPanelLoaded() { $(“#theTextInput”).focus(); } $(document).ready(function() { $(“#myDropDown”).change(onDropDownChanged); } The first time the change handler is fired, it does the ajax update, and the text […]