Jquery.Hover不适用于动态元素 [英] Jquery.Hover not working for dynamic Element
本文介绍了Jquery.Hover不适用于动态元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
$(。inboxfeedlist li)。hover(function(e){alert ');}
这不适用于动态创建的元素,即使我使用
$(。inboxfeedlist li)bind('hover',function(){})
$ c $ 解决方案
$ b div> 使用实时方式:
$(。inboxfeedlist li)。live('hover' (e){alert('');});
旁注 hover 确实需要两个回调函数,你的意思是 mouseover
Here is my code
$(".inboxfeedlist li").hover(function(e){alert('');}
This is not working for dynamically created elements, even i have use
$(".inboxfeedlist li").bind('hover',function(){})
is also not working, what's problem with code.
解决方案 Use the live method:
$(".inboxfeedlist li").live('hover', function(e){alert('');});
A side note hover does take two callback functions, did you mean mouseover
这篇关于Jquery.Hover不适用于动态元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文