jQuery filter syntax troubleshooting
<p>I am having trouble understanding why my simple jquery code does not get recognized. When a user clicks on a tab, the function supposes to toggle the tabs' classes.  I am using the filter and not methods to determine which tab was clicked.  The similar line of code works for me before, but it does not seem to work in my new code.  The function can capture the the id of the element just fine, but the filter parameter does not work.</p>

<p>Please give some insights on the statement that contains the filter method.  In my example code, if I click on tab 1, how do I get it to do something (ie add class)?  <a href="http://jsfiddle.net/rq2KD/" rel="nofollow">jsfiddle link </a></p>

<p>edit: Please give reasons why my <code>filter</code> statement does not work, I am using it in combination of <code>not</code> to filter in and out elements, which has worked for me before.  See this <a href="http://stackoverflow.com/questions/7657911/jquery-troubleshooting-this-jquery-code">link</a></p>

<p>TIA</p>

<pre><code>    $(function(){

    $('.tabbar').click(function(event){ 
        var id = event.target.id;
          $('.tabbar').filter('#'+id).addClass("tabn");
          //alert(id);
    });
});
</code></pre>

<p>HTML code</p>

<pre><code>    &lt;div class="tabbar" &gt; &lt;span name="tabs" class="tabm" id="tab1"  &gt;tab 1&lt;/span&gt;
&lt;span name="tabs" class="tabn" id="tab2"  &gt;tab 2&lt;/span&gt; 
      &lt;/div&gt;
</code></pre>
