jQuery getting loaded before UI controls are loaded
Hi,
I am using ASP.NET , C# and jQuery for creating a web application.
How to check if the User Interface elements are loaded before the jQuery function executes?
Currently, In my aspx page I have the below labels declared
- <asp:label id="lbl1" runat="server" />
- <asp:label id="lbl2" runat="server" />
In the aspx file, I have referred a javascript file.
In the javascript file, I have the below:
- $(document).ready(function () {
- $('#' + '<%= lbl1.ClientID %>').text('One');
// $('#lbl1').text('One'); // Tried this as well
});
The label is not getting found and hence the text is not getting assigned.
I can try window.load, but $(window).load() will work only the first time the page is loaded. when doing dynamic stuff (example: click button, wait for some new images to load), this won't work
How to make sure that UI is loaded and then the jQuery is executed. I am not looking for 3rd party plugins.
Thanks