You'll need to do something along the lines of:
$('a.collapse_device').click(function() {
$(this). // this gets the a.collapse_device itself
parent(). // this gets the span
parent(). // this gets the li
parent(). // this gets the ul
parent(). // this gets the div.device_header
Hi Jody,
The .next() method only works for *sibling* elements. Let's take a
look at your HTML again, but with another element added and with some
indentation:
Device Name
-
Siblings are tags who have the same parent. For example:
.
bar and far are siblings, foo and wax are siblings, far and wax aren't
siblings.
Maybe try this:
$('.collapse_device').click(function() {
$(this).parents('.device_header').next().hide();
});
That will walk up the hierarchy to
3 matches
Mail list logo