Tag: onavailable

使用jQuery时如何做某事?

我用javascript加载了 , 并且一旦可用就需要关注它。 jQuery中的live()必须指定一个在我的情况下不存在的“类型”。 我需要做以下的事情: $(‘#target’).onAvailable($(‘#target’).focus()); 如何用jQuery实现这个?

jQuery中是否有onAvailable()函数?

在将新的html插入DOM之后,我需要添加一些监听器。 但新元素不能立刻获得。 我的代码: $(‘#loader’).clone().removeAttr(‘id’).load(“Views/chatBox.html”).appendTo(‘body’); $(‘#chat’) .focus(function() { $(this).addClass(‘jV’); }) .blur(function() { $(‘#chat’).removeClass(‘jV’); }); 哪个不行。 使用live()仍然无法正常工作: $(‘#chat’).live(‘focus’,function() { $(‘#chat’).addClass(‘jV’); }) .live(‘blur’,function() { $(‘#chat’).removeClass(‘jV’); });