adding an "active" class to parent and child element
<p>Need to add an active class to both parent and child element if a user clicks on the child element in a list. My html is as follows:-</p>

<pre><code>&lt;ul class="tabs"&gt;
      &lt;li class="accordion"&gt;&lt;a href="#tab1"&gt;Bar&lt;/a&gt;
         &lt;ul class="sub"&gt;
           &lt;li&gt;lorem/li&gt;
           &lt;li&gt;ipsum&lt;/li&gt;
           &lt;li&gt;Lorem Ipsum&lt;/li&gt;
           &lt;li&gt;Dolor Sit Amet&lt;/li&gt;
         &lt;/ul&gt;
      &lt;/li&gt; 
</code></pre>

<p>and I'm using the jquery code below to add an active class to both the parent and child element yet I'm having errors:-</p>

<pre><code>$("ul.tabs li").click(function() {
      $("ul.tabs li").removeClass("active").find(".sub li").removeClass("active"); 
      $(this).addClass("active").find(".sub li").addClass("active"); 
});
</code></pre>

<p>Then styled my active class in CSS. say example</p>

<pre><code>.active {background:#EFEFEF;}
</code></pre>

<p>only the clicked (this) child element should have the active class applied to it and not the whole li child elements. Now together with the child li (say lorem) the parent li (bar) should also be highlighted. Think of it like a tree accordion menu where both the selected child element and it's parent li have the active class with different css styling.</p>
