views:

36

answers:

1
+3  A: 

I think you're looking for the :has selector

$('ul.first:has(ul.second) h2 a').attr("href", "#");

Or, closer to what you're doing:

var second = $(".second");
if(second.length && second.closest(".first")) {
   second.closest(".first").find("h2 a").attr("href", "#");
};
Kyle Butt
great great great, that's what I was looking for !
owca