Hi Rob,
Here I think the documentation will be very helpful.
http://docs.jquery.com/Traversing/next#expr
You can insert an expression into the .next() to filter it further --
by class, tag name, id, whatever.
So, in your situation, you can do this:
$("dt.current").next('dd').addClass("show")
If the next element isn't a <dd>, nothing will happen.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Nov 30, 2007, at 8:27 AM, Rob_ wrote:
Managed to fix the previous problem and am left with a less critical
one...:
$("dt.current").next().addClass("show");
...adds this class to my <dd> submenu.
However, when there's no submenu, the class is added to the next
element, like the next <dt>
So, with this code I would *not* like to add class="show" if next() is
not a <dd>
Again, had to give up after 20 times of trying and thinking how easy
and intuitive this one would be... ;-p