JQuery keep class for selected menu
<p>I have the following menu on a header.php page that is included on each link page as follows:</p>

<pre><code>&lt;nav id="main-nav"&gt;
    &lt;ul class="container_12"&gt;
        &lt;li&gt;
         &lt;ul&gt;
            &lt;li&gt;&lt;a href="home.php"&gt;&lt;? echo TEXT_DASHBOARD_HOME;?&gt;&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="plans.php"&gt;&lt;? echo TEXT_DASHBOARD_PLAN;?&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="voucher.php"&gt;&lt;? echo TEXT_DASHBOARD_VOUCH;?&gt;&lt;/a&gt;&lt;/li&gt;
         &lt;/ul&gt;
        &lt;/li&gt;   
    &lt;/ul&gt;
&lt;/nav&gt;
</code></pre>

<p>Now when I click on any menu item I execute the following code contained on header.php:</p>

<pre><code>$(document).ready(function()
{
$('nav &gt; ul &gt; li &gt; ul &gt; li').addClass('current').siblings().removeClass('current');
});
</code></pre>

<p>and it works as soon as I stay on the same page, as soon as I click on another menu and I get redirected to another page and the class gets removed, how can I pass a variable of the <code>li.index()</code> that was clicked and add class to that specific <code>&lt;li&gt;</code>?</p>

<p>Thanks</p>
