toggleClass and remove class from all other elements
<p>How can I toggleClass and remove class from all other elements?
Consider a div that contains a tags:
html:</p>

<pre><code>&lt;div class="size"&gt;
   &lt;a href=""&gt;blahblah&lt;/a&gt;
   &lt;a href=""&gt;blahblah&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>jQuery:</p>

<pre><code> $(".size a").click(function(){
 $(this).toggleClass('checked');
 if($(".size a").hasClass('checked')){
     $(this).removeClass('checked');
  }
 })
</code></pre>

<p>I want to add class "cheched" to element and remove the class "ckeched" from other elements that have class "checked" . My code remove all classes. How can I add specific class and remove other element's class with click?
Thanks in advance</p>
