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":

$(".treeHeader").click(function(){
    $("ul", this).toggle();
});

http://docs.jquery.com/Core/jQuery#expressioncontext

Karl Rudd

On Feb 13, 2008 9:14 AM, 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").toggle();
> });
>
>

Reply via email to