Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  59] [ 6]  / answers: 1 / hits: 19955  / 12 Years ago, mon, june 11, 2012, 12:00:00

I have an html which mostly builds itself on page load, it works perfectly when I run it independently , but I need to put this html inside another html's div, I do this using ajax/jquery's .load function



i.e $('#myDiv').load('myHtml.html')



but loading it this way in the div doesn't trigger the body onload event and the page is not properly build. Can you suggest how I can somehow trigger the body onload function or some other way to achieve the same


More From » jquery

 Answers
38

place it inside $(document).ready()



   $(document).ready(function(){

$('#myDiv').load('myHtml.html');
});

[#84999] Saturday, June 9, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
agustindejonm

Total Points: 738
Total Questions: 84
Total Answers: 84

Location: Northern Ireland
Member since Mon, Nov 14, 2022
2 Years ago
agustindejonm questions
Fri, Jun 25, 21, 00:00, 3 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Sat, May 16, 20, 00:00, 4 Years ago
;