jQuery add active class to link in submenu from main menu on click
<p>I'm trying to to add an active class to a submenu (subnav) item when an item
in the main navigation is clicked. The goal is to highlight the submenu item when
the main menu item is clicked. The submenu items are links to sections of a page:</p>

<pre><code>&lt;div id="subnav"&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href="#adaptivetech"&gt;Adaptive Technology&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#iepspecialed"&gt;IEP and Special Ed Forms&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#behaviorplanning"&gt;Behavior Planning Forms&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#npsnpainfo"&gt;NPS/NPA Information and Forms&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#privateschoolref"&gt;Private School Referral for Assessment&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#programtransfer"&gt;Program Transfer&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
</code></pre>

<p>Here is what the main menu looks like:</p>

<pre><code>&lt;ul class="sf-menu"&gt;
    &lt;li&gt;&lt;a href="newselpasite3.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Meetings/Workshops&lt;/a&gt;
     &lt;ul&gt;
    &lt;li&gt;&lt;a href="#"&gt;Selpa Workshops&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Selpa Committee Meeting for 2012-2013&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Archived Agendas and Minutes&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" class="top_parent"&gt;Services&lt;/a&gt;
    &lt;ul&gt;
    &lt;li&gt;&lt;a href="#"&gt;Adaptive Technology Center&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;Alternative Dispute Resolution&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#"&gt;Autism Support&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;BEST Schoolwide Positive Behavior Support&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#"&gt;Community Advisory Committee&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Early Start Infant Program&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="#" class="active"&gt;Forms&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#adaptivetech"&gt;Adaptive Technology&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#iepspecialed"&gt;All IEP and Special Education Forms&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href="#behaviorplanning"&gt;Behavior Planning Forms&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href="#npsnpainfo"&gt;NPS/NPA Information and Forms&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href="#privateschoolref"&gt;Private School Referral for Assessment&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href="#programtransfer"&gt;Program Transfer&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;/li&gt;
</code></pre>

<p></p>

<p>Thanks.</p>
