HTML:
-
.parent() by itself just refers to the immediate ancestor of a node, but you can also do:
var li = $('a.del').parents('li.comment');
to have JQuery go back up the DOM tree until it finds a matching ancestor node. In this case, li will point at the a's li ancestor.
edit: forgot that .parent() only goes up one level, while .parents() goes up the entire tree. Both accept a selector argument, however.