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
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
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":
3 matches
Mail list logo