Replacing live with on function [closed]

You missed the selector parameter that allows you to use delegated events.

$(document).on('click', '#remove', function() {
    $(this).closest('div.container').remove();
});

Where document can be replaced by any #remove container that exists at binding time

Browse More Popular Posts

Leave a Comment