我想检查一下iframe是否在用户单击按钮后加载。如何检测iframe是否已加载?
我
$('#MainPopupIframe').load(function(){
console.log('load the iframe')
//the console won't show anything even if the iframe is loaded.
})
HTML
<button id='click'>click me</button>
//the iframe is created after the user clicks the button.
<iframe id='MainPopupIframe' src='http://...' />...</iframe>
有什么建议?
顺便说一下,我的iframe是动态创建的。它不会加载初始页面加载。
[点击](http://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe) –