Show the path of a nested list with jQuery
<p>So I have a nested list:</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;
        &lt;a href="#"&gt;a&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;
                &lt;a href="#"&gt;a.1&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;a href="#"&gt;a.2&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;a href="#"&gt;b&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;
                &lt;a href="#" class="open"&gt;b.1&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;a href="#"&gt;b.2&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>And I have an event that fires on a click that moves the item to the next nested list (if you click a, it will show a.1 and a.2 in a list). What I want to do is to be able to set the current menu by simulating clicks; however, I don't know of the best way to get the chain to execute the function. In this instance, I'd have to execute the click on b, and then on b.2, and in that order. How could I accomplish this with the least amount of code? And the real kicker is that I might have many nested lists (up to 4), so I want this to be somewhat flexible. Help! This is as far as I've made it:</p>

<pre><code>currentMenu: function() {
    var $open = $mID.find('.open');
    if($open.length &gt; 0) {

    }
}
</code></pre>

<p>Thanks!</p>
