Binding events to a dynamically created element that has a static ancestor is fairly easy using jQuery, as demonstrated in this answer:
$(staticAncestors).on(eventName, dynamicChild, function() {});
But what if the dynamicChild
is of a dynamicAncestor
? Is there any way to make the following work:
$(dynamicAncestors).on(eventName, dynamicChild, function() {});