如何查找元素是否已使用 JQuery 加载
我正在将数据加载到 Flexigrid 中。我正在尝试使用 JQuery 选择器使行可单击,但我无法这样做。我想知道元素是否已完全加载,我该怎么做?
我想做一些类似 if(element.load == true){//do this}
的事情。我不知道如何检查。有人可以帮我解决这个问题吗?
好的,我已经有了这个 div,并且正在将 Flexigrid 绑定到该 div。我想知道flexigrid是否已绑定。
$("#GridLoad").flexigrid();
我想知道flexigrid是否已绑定,之后我需要运行一段代码。
在 div Gridload
上使用 live()
总是 true,因为它已经存在了。 :(
I am loading data into the flexigrid. I am trying to use JQuery selectors to make the rows clickable, but I am unable to do so. I want to know if the element has been fully loaded, how do I do that?
I want to do something like if(element.load == true){//do this}
. I am not sure of how to check that out. Could anybody help me with this.
Ok, so I already have this div, and am binding a flexigrid to that div. I want to know if the flexigrid has been bound.
$("#GridLoad").flexigrid();
I want to know if the flexigrid has been bound, after that, I need to run a piece of code.
Using a live()
on div Gridload
would always be true as it is already there. :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎有一个
onSuccess
回调。否则,如果您绑定的内容在表更新时丢失,请通过
on() 附加事件
或者只是在持久祖先元素处捕获它们并检查事件。目标
。There appears to be an
onSuccess
callback.Otherwise, if the things you are binding are being lost when the table updates, attach the events via
on()
or simply capture them at the persistent ancestor element and examineevent.target
.您可以使用 $(element).live('click', function () { // do some });
这样,如果稍后加载,它将具有适当的事件绑定。
You can use $(element).live('click', function () { // do something });
so that if it later loads it'll have the appropriate event binding.
你可以使用jquery的load方法的回调函数。
像这样:
$('#result').load('ajax/test.html', function() {
Alert('已执行加载。');
});
即使您没有使用“load”方法,jquery 中的几乎所有方法都支持在功能完成后发生的回调。
例如ajax()有成功和失败回调,动画有回调等。
you could use the callback function of jquery's load method.
like so :
$('#result').load('ajax/test.html', function() {
alert('Load was performed.');
});
Even if you are not using 'load' method, almost any method in jquery supports callbacks which happen after the functionality has been completed.
For example, ajax() has success and failure callbacks, animations has callbacks, etc.