Thanks for asking, let me try and clear up some of your questions. The DOM looks something like this:
<ul id="control"> <li><a href="A">A</a> <ul> <li>AAAAA</li> </ul> </li> <li><a href="B">B</a> <ul> <li>BBBBB</li> </ul> </li> <li><a href="C">C</a> <ul> <li>CCCCC</li> </ul> </li> <li><a href="D">D</a> <ul> <li>DDDDD</li> </ul> </li> </ul> - Onload all nested ULs (withing #control) are hidden - On first click, first child of the <a> is :visible - On Second click: - Was the second click the same as the first click? - Yes: Toggle closed the child UL - No: Close anything open (there should only be 1 open at anytime), then open the corresponding child UL So like I stated earlier I guess where I'm stumbling is on how to collect and check back and know what was actually clicked, and how to keep checking agaisnt it in the future. Hope that clears things up. :) David On Nov 20, 5:19 pm, Wizzud <[EMAIL PROTECTED]> wrote: > Some questions: > > What happens on the first click? Nothing, or "Hide child ul"? > What happens on the third, fourth, nth, clicks? Does any one click > always check against the preceding click, regardless of whether that > preceding click matched it's own preceding click or not? > Are you always checking nth click against (n-1)th click? Or, if you > get a match [ nth = (n-1)th ] are you clearing down your 'clicks > stack' and starting again from 'first' click? > What is 'child ul' a child of? The preceding [ (n-1)th ] clicked > element? Or does it depend on whether nth = (n-1)th? > > On Nov 20, 6:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Hello everyone, > > > Just started working with jQuery in the past few weeks, fairly > > impressed thus far. :) > > > I've got a questions which actually might touch base more on a general > > JS question but figured might as well ask it. > > > What I'm trying to do: > > > // What got clicked first? (capture) > > // What was clicked Second? (capture) > > // Was the second click the same as the first? > > // Hide child ul > > // else > > // Hide child ul + open new child from second parent > > > I guess my key stumbling block is storing the last clicked element > > into memory to check agaist during the next function call. > > > I've this so far: > > var $whatClicked = ($(this).get()); > > > Any help is greatly appreciated. > > > Cheers, > > David