what you want is to remove the outer block div, or?
there you can go different ways.
you can click the outer block div to remove it or you can click anywhere else to remove the block div but then you have to look for the path from your click-event to the div you want to remove
the first one works too, you can see it here
http://jsfiddle.net/dthec/1/when you don't know how many levels will be there you can als work with ".closest()"
- $("a.remove").click(function () {
- $(this).closest('.block').remove();
- });
there is another was too, you can use ".parents()"
- $("a.remove").click(function () {
- $(this).parents('div').remove();
- });
that will remove all divs, which are parents of the clicked element