在页面完全加载后执行某些操作 [英] Do something AFTER the page has loaded completely
本文介绍了在页面完全加载后执行某些操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用一些嵌入代码,动态地将HTML插入页面,因为我必须修改动态插入的HTML,我想要一个jquery函数等到页面加载,我试过延迟
但它似乎无法工作。
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.
因此,例如,动态插入的HTMl有一个元素 div#abc
So for example, the dynamically inserted HTMl has an element div#abc
我有这个jquery:
and I have this jquery:
if ( $('#abc')[0] ) {
alert("yes");
}
警报未显示。
我很感激任何帮助
谢谢
推荐答案
$(window).load(function () {
....
});
如果你必须等待iframe(并且不关心资产,只需要DOM ) - 试试这个:
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
});
});
这篇关于在页面完全加载后执行某些操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文