chasethesunnn
chasethesunnn

Reputation: 2234

Selected all child elements to hide, but wont unhide all elements on click

I am making a jquery accordion following css-tricks tut here. I modified the code a bit and I selected all the elements within the parent element and hid it. Upon click it will reveal the dd tags, but not the ul or h3 tag. I feel like it has to do with the code on line 6 or 7 of the JS section but I don't understand JS/jQuery well enough to know why. Any help would be greatly appreciated.

Example: http://jsfiddle.net/undeE/

Upvotes: 1

Views: 101

Answers (1)

Ram
Ram

Reputation: 144689

next only selects the next sibling of the selected element, you can use nextUntil method instead.

var $target = $this.parent().nextUntil('dt');

http://jsfiddle.net/bDdCH/

However, if you wrap the target elements by another element (like a div element) then next will work as expected.

Upvotes: 2

Related Questions