[英]jquery: bind LOAD event after creating a iframe DOM object
我該怎么做呢?
$('#divToInsert').html('<iframe id="outputPage" src="/Folder/webpage.aspx" width="90%" height="600" frameborder="0" scrolling="yes" style="overflow-x: hidden"><p>WARNING: Your browser does not support iframes. Please contact your adminstrator for assistance.</iframe>');
$('#outputPage').unbind('load');
$('#outputPage').bind('load', function() {
alert('done!');
});
錯別字?
// ---------v---------------there's a "t" that shouldn't be there
$('#outputPaget').bind('load',
更正后對我有用。
確保DOM也已加載。
$(function() {
$('#divToInsert').html('<iframe id="outputPage" src="/Folder/webpage.aspx" width="90%" height="600" frameborder="0" scrolling="yes" style="overflow-x: hidden"><p>WARNING: Your browser does not support iframes. Please contact your adminstrator for assistance.</iframe>');
$('#outputPage').unbind('load');
$('#outputPage').bind('load', function() {
alert('done!');
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.