jQuery live, if you look through the $.on style, would look like this:
$(document).on("click", "li.bibeintrag", function(){ });
It will listen for click events at the document level and determine if their purpose matches the second parameter of $.on . We encourage you to do this ourselves, but instead of listening to the level of the document, we want to get to know the element itself much more closely (so the event should not spread too far before it is processed).
Since you are responding to clicks on li , listen at the parent level:
$("ul#myList").on("click", "li.bibeintrag", function(){ });
Keep in mind that without providing the second parameter $.on event handler is bound to the element itself, that is, you will not get $.live behavior that will respond to dynamically added elements.
Sampson May 15, '12 at 15:50 2012-05-15 15:50
source share