I am pulling my hair, trying to understand why the mouseover event will not work with the .on handler with a dynamically created element from ajax. The only thing that works is the code with .live, but I understand that it is deprecated.
$(".dropdown ul li").live("mouseover", function() {
alert('mouseover works');
});
However, when I try to use .on, it will not work - no matter what options I try (document.ready, .mouseover, etc. etc.)
$(".dropdown ul li").on("mouseover", function() {
alert('mouseover works');
});
Event handlers are at the bottom of the code, so they are executed last. Does anyone have an idea of ββwhat I'm doing wrong?
source
share