jQuery - change the CSS of the menu item's path in the dynamically created menu
<p>I'm using that jQuery Vertical Menu Library <a href="http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm" rel="nofollow">www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm</a> I want to accomplish the selection of the selected path. Let's say that I go through that menu (in the demo on that site above) by the path:</p>

<pre><code>Folder 2 &gt; Folder 2.1 &gt; Folder 3.1.1 &gt; SubItem 3.1.1.1
</code></pre>

<p>When I click on the <code>SubItem 3.1.1.1</code> I want that the all previous items (from the path above) changes their backgrounds. The code below selects only the top-most item. How to fix that ?</p>

<pre><code>    $('#nav &gt; li').click(function () {
        $(this).children('a').css('background-color', 'red'); 
        $(this).parents('ul').each(function () { $(this).prev('a').css('background-color', 'red'); });
    });
</code></pre>

<p>. In that scenario, my code fails.</p>
