相关疑难解决方法(0)

如何检测iframe是否已加载?

我试图检查用户单击按钮后是否加载了iframe.

我有

$('#MainPopupIframe').load(function(){
    console.log('load the iframe')
    //the console won't show anything even if the iframe is loaded.
})
Run Code Online (Sandbox Code Playgroud)

HTML

<button id='click'>click me</button>

//the iframe is created after the user clicks the button.
<iframe id='MainPopupIframe' src='http://...' />...</iframe>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

顺便说一句,我的iframe是动态创建的.它不会加载初始页面加载.

html javascript iframe jquery

98
推荐指数
1
解决办法
26万
查看次数

标签 统计

html ×1

iframe ×1

javascript ×1

jquery ×1