If you want to perform an action immediately after insert, then you should probably just have the logic as part of the success handler for the AJAX call.
If you actually want execute this logic on some action on one of the elements, then on()
should be your approach. Just note that the on()
needs to be attached to a parent element to the dynamically elements which is present at the time the on()
function is called. Usage would be like this:
$('#container_available_at_page_load').on('click', '.class_of_dynamic_elements', function() {
// do something
});