Jquery.Hover not working for dynamic Element

2020-03-24 04:12发布

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.

8条回答
ゆ 、 Hurt°
2楼-- · 2020-03-24 05:06
$('.inboxfeedlist li').live('hover', function(e) { alert(''); });

jQuery live

jQuery delegate

查看更多
Luminary・发光体
3楼-- · 2020-03-24 05:06

Here is the use and details of these functions

http://api.jquery.com/live/

$( selector ).live( events, data, handler ); // jQuery 1.3+

$( document ).delegate( selector, events, data, handler ); // jQuery 1.4.3+

$( document ).on( events, selector, data, handler ); // jQuery 1.7+

查看更多
登录 后发表回答