我正在运行这个:
$("*:not(#boo) .content").livequery(function(){
$("input, select").blah();
});
blah()
看起来像这样:
(function( $ ) {
$.fn.blah = function(){
var that = this;
return this.each(function(){
$(this).bind('change', function(){
// do some stuff here
return true;
}).change();
});
};
})(jQuery);
html看起来像:
<div id="boo">
<div class="content">
<input type="text" />
<input type="text" />
...
</div>
</div>
<div class="content">
<input type="text" />
<input type="text" />
</div>
...
所以我要做的是将该函数和事件附加到不在内部的每个输入元素上#boo
。这行得通,但问题是它像每秒一样一遍又一遍地进行,并且浏览器冻结了。
我需要 livequery,因为 html 有时会更新,我需要再次将事件附加到新元素。
那么如何检查是否blah()
已经应用于输入元素并停在那里?