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
solved Replacing live with on function [closed]