$(this).siblings() only returns the immediate descendents of 'this'. Try using $(this).find() instead. -Hector
On Wed, Apr 1, 2009 at 9:28 AM, sinkingfish <sinkingf...@gmail.com> wrote: > > > Hi I trying to write a script which allows for easily hiding and revealing > content by just specifying the correct class names. > > The problem I'm having is that my current script will only toggle elements > if the 'toggletarget' is a immediate sibling of the 'togglebutton'. My > problem is that the 'togglebutton' may or may not be nested within div's, > tables etc. > > Is their a way to find all the children of an element? Am I missing > something? > > Ta > > > $(function(){ > $("div.togglecontainer span.togglebutton").click(function() { > $(this).siblings("div.toggletarget").slideToggle(); > > > //$(this).parent('div.togglecontainer').find('div.toggletarget').slideToggle(); > }).css('cursor', 'pointer'); > $('div.toggletarget').hide(); > }); > -- > View this message in context: > http://www.nabble.com/Getting-all-children%2C-not-just-immediate-children---tp22830245s27240p22830245.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >