I didn't realise .nextAll existed! I was using this -
$("dt.solution").click(function() { // This is for toggling multiple dd elements var obj = $(this).next(); // when you click dt.solution while (obj.is("dd")) { // it captures the next element (dd) as a variable obj.toggle(); // then until the next element ceases to be a dd obj = obj.next(); // it toggles the element contained in the variable (dd) } // then it flips onto the next one! return false; }); On Sep 19, 6:58 pm, tobaco <[EMAIL PROTECTED]> wrote: > try it this way: > > <script type="text/javascript"> > $(function(){ > $('[EMAIL PROTECTED]"http://"]').attr('target', '_blank'); > $('[EMAIL PROTECTED]"https://"]').attr('target', '_blank'); > $(".stripes dd").hide(); > $(".stripes dt").click(function(){$ > (this).nextAll("dd").toggle("slow"); > }); > > }); > > </script> > > On 19 Sep., 05:24, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > This is probably a noob question but... > > > I have a bunch of definition lists on a page with the same class so > > that I can stripe every other <dd> in the list. What I want to do is > > hide the <dd> elements and when I click on the <dt> toggle the <dd> > > elements to visible. I want this to happen only on the <dd> elements > > in the same definition list as the title I am clicking, not all the > > <dd> elements on the entire page. What is happening now is that all of > > the <dd> in all of my definition lists are being toggled when I click > > on any of the <dt> elements on the page. > > > I am sure this is a simple solution, but I can't seem to wrap my head > > around it. The code is below. > > > <script type="text/javascript"> > > $(function(){ > > $('[EMAIL PROTECTED]"http://"]').attr('target', '_blank'); > > $('[EMAIL PROTECTED]"https://"]').attr('target', '_blank'); > > $(".stripes dd").hide(); > > $(".stripes dt").click(function(){$(".stripes dd").toggle("slow"); > > });}); > > > </script> > > > Thanks for your help! > > -Paul