[jQuery] Re: Getting all children, not just immediate children??

2009-04-03 Thread Hector Virgen
Yes, parents() returns all parents that match the given selector. closest() will match the nearest parent that matches the selector. -Hector On Fri, Apr 3, 2009 at 1:45 AM, Brian Gallagher wrote: > Sorry wasn't at the computer yesterday, that worked a treat, thanks. > So parents() goes further t

[jQuery] Re: Getting all children, not just immediate children??

2009-04-03 Thread Brian Gallagher
Sorry wasn't at the computer yesterday, that worked a treat, thanks. So parents() goes further that the direct parent? -Brian On Thu, Apr 2, 2009 at 10:18 PM, Ricardo wrote: > $(this).parents('div.togglecontainer:first').find > ('div.toggletarget').slideToggle(); >

[jQuery] Re: Getting all children, not just immediate children??

2009-04-02 Thread Ricardo
I guess div.togglecontainer is not the actual parent of 'this' but a higher ancestor? Try $(this).parents('div.togglecontainer:first').find ('div.toggletarget').slideToggle(); On Apr 1, 6:21 pm, Brian Gallagher wrote: > Don't know how the space got there, but not in my original. > I just quickl

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread mkmanning
Can you provide the relevant markup? On Apr 1, 2:21 pm, Brian Gallagher wrote: > 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 th

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread Brian Gallagher
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').slideT

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread mkmanning
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,

[jQuery] Re: Getting all children, not just immediate children??

2009-04-01 Thread Hector Virgen
$(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 wrote: > > > Hi I trying to write a script which allows for easily hiding and revealing > content by just specifying the correct class name