Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  171] [ 2]  / answers: 1 / hits: 46133  / 13 Years ago, wed, january 18, 2012, 12:00:00

I have lots of HTML generated on $(document).ready(). I have a simple window system. But not only it is generated on $(document).ready() - also some HTML elements (different JS files put stuff into $(document).ready() ). I want my window system to be generated after $(document).ready() is called. So how do I handle a function to be called after all the code registered in $(document).ready() is completed?


More From » jquery

 Answers
10

There is another event which is fired later. it's $(window).load(); This is fired after all resources are loaded.



But perhaps you want this:



function loadWindowSystem(){
// load window system here
}

$(document).ready(function(){
// do some html stuff here

loadWindowSystem();
})


This way you can separate your code in functions.


[#87945] Tuesday, January 17, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gregoriocoya

Total Points: 549
Total Questions: 111
Total Answers: 104

Location: Saint Helena
Member since Mon, Jan 16, 2023
1 Year ago
;