我想检查 iframe 是否加载了以下代码:
$(document).ready(function() {
jQuery('#iframeID').ready(somefunction);
}
似乎在加载 iframe 之前调用了“somefunction”(iframe 是空的 - 只是空的 html-head-body)。
知道为什么会这样吗?
谢谢。
最佳答案
试试这个。
$('#iframeID').load(function() {
callback(this);
});
在处理 iFrame 时,使用 load()
事件代替 $(document).ready()
事件就足够了。
关于javascript - 检查 iframe 是否加载到 $(document).ready 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17045645/