jquery html 回调 [英] jquery html callback

查看:19
本文介绍了jquery html 回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有 html() 函数的回调或检查它是否已完成的方法.例如:

Is there a callback for the html() function or a way to check that it is finished. For example:

$("#some_div").html('something here');

if($("#some_div").html() == ''){
//do something here
}

我正在设置帖子中元素的 html.有时它不加载所以当它不加载时我希望它做一些事情,这可能吗.我现在拥有它的方式总是做另一件事,因为它在检查它有 html 时还没有设置 html.

I am setting the html of an element from a post. Sometimes it doesnt load so when it doesnt load I would like for it to do something, is this possible. The way I have it now it always does the other thing because it hasnt set the html by the time it checks that it has html.

推荐答案

html() 是一个同步操作.DOM 的实际更新取决于您的 html 内容是什么.如果您有