jquery toggleClass not working
<p>i have two links and want to toggle its class when click on any link.</p>

<p>my links are</p>

<pre><code>&lt;a id="single" class="btn" &gt;
&lt;a id="double" class="btn active"&gt;
</code></pre>

<p>so i want to change class from <code>btn to btn active</code>
i have this code </p>

<pre><code>$(document).ready(function(){
    $('a.btn').click(function(){
       $(this).removeClass('focus active');
       $(this).removeClass('active');
       $(this).toggleClass("btn active");
   });
});
</code></pre>

<p>I tried with this code because in some other javascript in my accpliceation is also adding these classes. </p>

<p>this work fine when its like bellow</p>

<pre><code>&lt;a id="single" class="btn" &gt;
&lt;a id="double" class="btn active"&gt;
</code></pre>

<p>but when my first button is active like bellow</p>

<pre><code>&lt;a id="single" class="btn active" &gt;
&lt;a id="double" class="btn"&gt;
</code></pre>

<p>this did't work but give classes as bellow when click on double</p>

<pre><code>&lt;a id="single" class="btn active" &gt;
&lt;a id="double" class="active"&gt;
</code></pre>

<p>this is strange cause its working when <code>&lt;a id="double"</code> is active but did't work when <code>&lt;a id="single"</code> is active.</p>

<p>all i want to do is when click on any link,
1. remove all classes from old link and give old link class "btn"
2. remove all classes from clicked link and give class "btn active"</p>

<p>how to fix this?</p>