Reputation: 2234
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
Reputation: 144689
next
only selects the next sibling of the selected element, you can use nextUntil
method instead.
var $target = $this.parent().nextUntil('dt');
However, if you wrap the target elements by another element (like a div element) then next
will work as expected.
Upvotes: 2