[英]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.