You have to do it that way because the context has changed. Thus "this" in the second anonymous function will refer to something different than in the first. A lot of people use the convention "var self = this" or something similar.
Also within the anonymous function you can do this: siblings.find( etc ); category.find( etc ); ...since they are already jQuery objects. -- Josh -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 703designs Sent: Wednesday, December 03, 2008 9:44 AM To: jQuery (English) Subject: [jQuery] Scope variables in anonymous functions? What I'm trying to figure out is how I can access parent scopes from a nested anonymous function. As you can see here, I'm managing to do this by assigning "this" to variables, but I know that there's a way to pass "this" into the anonymous functions: $(".responsibleCouncil .category").each(function() { var category = $(this); var input = $(this).find(".toggler input"); var siblings = $(this).siblings(); input.click(function() { $(siblings).find("ul").hide(); $(category).find("ul").show(); }); }); Basically, those three assignments at the top of the first anonymous function would be unnecessary if I knew of a better way to access "this" from nested functions.