Don't know how the space got there, but not in my original.
I just quickly tried $(this).find("div.toggletarget").slideToggle(); but it
didn't work as I suspected.

As you can see in my snippit post I left the commented line in :
$(this).parent('div.togglecontainer').find('div.toggletarget').slideToggle();

The was I see this is : this, the togglebutton, get it's parent
togglecontainer and find it's child toggletarget. This doesn't work though.
Is my logic wrong?

Any other ideas?

Thanks

-Brian



On Wed, Apr 1, 2009 at 8:48 PM, mkmanning <michaell...@gmail.com> wrote:

>
> siblings() returns..siblings. Brothers/sisters, which aren't
> descendants.
> To get immediate children (sons/daughters), use children()
> To get descendants (sons/daughters, grandchildren, great-
> grandchildren, etc.) then use find()
>
> btw, do you mean to have a space here: .slideToggl e(); ?
>
> On Apr 1, 10:04 am, Hector Virgen <djvir...@gmail.com> wrote:
> > $(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').slideToggl
> e();
> > >            }).css('cursor', 'pointer');
> > >        $('div.toggletarget').hide();
> > > });
> > > --
> > > View this message in context:
> > >http://www.nabble.com/Getting-all-children%2C-not-just-immediate-chil.
> ..
> > > Sent from the jQuery General Discussion mailing list archive at
> Nabble.com.
>

Reply via email to