Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
71
rated 0 times [  75] [ 4]  / answers: 1 / hits: 107103  / 13 Years ago, fri, january 27, 2012, 12:00:00

I'm using some embed codes that insert HTML to the page dynamically and since I have to modify that dynamically inserted HTML, I want a jquery function to wait until the page has loaded, I tried delay but it doesnt seem to work.



So for example, the dynamically inserted HTMl has an element div#abc



and I have this jquery:



if ( $('#abc')[0] ) { 
alert(yes);
}


the alert doesn't show up.



I'd appreciate any help



Thanks


More From » jquery

 Answers
89
$(window).load(function () {
....
});


If you have to wait for an iframe (and don't care about the assets, just the DOM) - try this:



$(document).ready(function() { 
$('iframe').load(function() {
// do something
});
});

[#87773] Wednesday, January 25, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lailab

Total Points: 706
Total Questions: 102
Total Answers: 95

Location: Falkland Islands
Member since Mon, Jul 13, 2020
4 Years ago
;