jQuery 加载完成事件后的jQuery
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19218885/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 23:27:23 来源:igfitidea点击:
jQuery after load complete event
提问by IEnumerable
Im using .load() and .show() to dynamicly load some HTML.
我使用 .load() 和 .show() 来动态加载一些 HTML。
//load the html
$('#mydiv').load('some_url');
// Display
$('#mydiv').show();
But here I need to call a Javascript function that only exist in the dynamic content, how can I tell if the .load() is complete ?
但是这里我需要调用一个只存在于动态内容中的Javascript函数,如何判断.load()是否完整?
回答by CodingIntrigue
回答by Royi Mindel
The load function get a callback function for complete
load函数获取回调函数完成
('#mydiv').load('some_url', function() {
alert( "Load completed." );
});