I’m loading some content via AJAX and trying to add some functionality,
I have this code to show/hide some content:
$('.list li').hover(
function() { $('.detail').show(); },
function() { $('.detail').hide(); }
);
This works fine on first load, but when in load more content via AJAX not work.
Any Ideas how to fix it?
Using
.onyou can delegate the event to the.listelement, so that adding newlielements will not break the intended functionality.Fiddle: http://jsfiddle.net/NGEfj/
If the
.detailelement is within theli, and not on its own somewhere else in the page:Fiddle: http://jsfiddle.net/NGEfj/1/