I want to remove 8th layer upper than this layer.
so I wrote this code : http://jsfiddle.net/3JaGg/
this code work now, but I want to know is there any better way ?
because I use parent() for 8 times.
$(this).parent().parent().parent().parent().parent().parent().parent().parent().remove();
Note: I use many DIVs because I want rounding the corners with CSS2
Use
closest(), this will traverse up the DOM to find the nearest element with the selector you provide – in your case,closest(".popup")will work.Example fiddle