[jQuery] Re: Selecting Descendents of This

2008-02-13 Thread J Moore
does this work? $(this).find('ul').toggle(); On Feb 12, 5:14 pm, studiobl <[EMAIL PROTECTED]> wrote: > I'm having trouble selecting descendents of "this" > > So, this works to initially hide uls: > $(".treeHeader ul").toggle(); > > But this doesn't work to toggle them: > > $(".treeHeader").click

[jQuery] Re: Selecting Descendents of This

2008-02-13 Thread Gordon
Try $('ul', this) On Feb 12, 10:14 pm, studiobl <[EMAIL PROTECTED]> wrote: > I'm having trouble selecting descendents of "this" > > So, this works to initially hide uls: > $(".treeHeader ul").toggle(); > > But this doesn't work to toggle them: > > $(".treeHeader").click(function(){ > $(this +" ul

[jQuery] Re: Selecting Descendents of This

2008-02-12 Thread Karl Rudd
Remember that, inside an event handler function (like 'click'), "this" is a _raw_ DOM node. To select the descendants you need to "wrap" it in a jQuery object: $(".treeHeader").click(function(){ $(this).find("ul").toggle(); }); Or, in this case, you can use the raw "this" as the "context":