Activating jquery tabber based on the clicked navigation link
<p>my website has a navigation with an id <code>#nav</code>. I want to activate a tabber based on the clicked navigation list. The navigation <code>#nav</code> has an html like this:- </p>

<pre><code> &lt;ul id ="nav"&gt;
    &lt;li&gt;&lt;a href="#tab1"&gt;Fred&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#tab2"&gt;Thom&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#tab3"&gt;Kay&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>when Fred is clicked from the navigation, I want to activate this on the tabber which has an html like this</p>

<pre><code> &lt;ul class="tabs"&gt;                                        
         &lt;li&gt;&lt;a href="#tab1"&gt;Fred&lt;/a&gt;&lt;/li&gt;                                      
         &lt;li&gt;&lt;a href="#tab2"&gt;Thom&lt;/a&gt;&lt;/li&gt;    
         &lt;li&gt;&lt;a href="#tab3"&gt;Kay&lt;/a&gt;&lt;/li&gt;       
&lt;/ul&gt;
</code></pre>

<p>and tab content like this:-</p>

<pre><code>&lt;div id="tab1" class="tab_content"&gt;Lorem&lt;/div&gt;
&lt;div id="tab2" class="tab_content"&gt;Ipsum&lt;/div&gt;
&lt;div id="tab3" class="tab_content"&gt;Dolor&lt;/div&gt;
</code></pre>

<p>so I wrote the following line of jquery </p>

<pre><code>$("#nav li").click(function() {

         var hash = location.hash;
          var sel = $("ul.tabs li a[href='" + hash + "'], ul#tabs li a[href='" + hash + "']");

    if (sel.length) { 

        sel.addClass("active").parent().addClass("active"); //Activate tab



        $(hash).show();
    }
</code></pre>

<p>it doesn't work! And how do I bind the onclick event to it? Sorry guys, I'm pretty new to jquery. I've seen previous examples on this site which doesn't work when I try to use. So can someone adapt my code/help me out please?</p>
