If the topmost container always has a class container, you can do something like this to get the identifier:
var id = $(".remove_the_main_container").parents(".container").attr("id");
But to remove the container you do not need an identifier. You can do something like this:
$(".remove_the_main_container").bind("click", function(eventObj) {
$(this).parents(".container").remove();
});
source
share