Href to a div on the same not working
<p>My problem is that I have an <code>&lt;a href="#"&gt; &lt;/a&gt;</code> tag and I can't go to the div and add a <code>inactive</code> class then when I choose another <code>&lt;a href="#"&gt; &lt;/a&gt;</code>, I can't remove the <code>inactive</code> class from the div chosen first and then I can't set it on the clicked id contained in the href div. Is there a js or jquery that can handle this? </p>

<p>Here is my code (href tags):</p>

<pre><code>&lt;div id="MainMenu"&gt;
    &lt;div class="list-group panel"&gt;
        &lt;a href="#demo1" class="list-group-item list-group-item-info" data-toggle="collapse" data-parent="#MainMenu"&gt;Orari Bus Italia &lt;/a&gt;
        &lt;div class="collapse" id="demo1"&gt;
            &lt;a href="#dropdown1" class="list-group-item"&gt;A2 CHIAVENNA - COLICO&lt;/a&gt;
            &lt;a href="#dropdown2" class="list-group-item"&gt;A3 CHIAVENNA - GORDONA - SAMOLACO&lt;/a&gt;
            &lt;a href="#dropdown7" class="list-group-item"&gt;A4 CHIAVENNA - CAMPODOLCINO - MADESIMO&lt;/a&gt;
            &lt;a href="#dropdown9" class="list-group-item"&gt;A6 CHIAVENNA - OLMO&lt;/a&gt;
        &lt;/div&gt;
        &lt;a href="#demo2" class="list-group-item list-group-item-info" data-toggle="collapse" data-parent="#MainMenu"&gt;Orari Bus St. Moriz &lt;/a&gt;
        &lt;div class="collapse" id="demo2"&gt;
            &lt;a href="#dropdown3" class="list-group-item"&gt;Orari Autopostale Svizzero da Chiavenna a St.Moritz&lt;/a&gt;
            &lt;a href="#dropdown4" class="list-group-item"&gt;Orari Autopostale Svizzero da Chiavenna a Lugano&lt;/a&gt;
        &lt;/div&gt;
        &lt;a href="#demo3" class="list-group-item list-group-item-info" data-toggle="collapse" data-parent="#MainMenu"&gt;Orari Treni &lt;/a&gt;
        &lt;div class="collapse" id="demo3"&gt;
            &lt;a href="#dropdown5" class="list-group-item"&gt;Orari Treni - Chiavenna - Milano&lt;/a&gt;
            &lt;a href="#dropdown6" class="list-group-item"&gt;Orari Treni - Chiavenna - Sondrio&lt;/a&gt;
        &lt;/div&gt;
        &lt;a href="#demo4" class="list-group-item list-group-item-info" data-toggle="collapse" data-parent="#MainMenu"&gt;Informazioni Turistiche&lt;/a&gt;
        &lt;div class="collapse" id="demo4"&gt;
            &lt;a href="#sectionB" class="list-group-item"&gt;Informazioni turistiche&lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>then, here there are the div tags that I have linked above:</p>

<pre><code>&lt;div class="tab-content"&gt;
    &lt;div id="dropdown1" class="tab-pane fade"&gt;
        &lt;h3&gt;Orari Bus Italia - A2 CHIAVENNA - COLICO&lt;/h3&gt;
        &lt;div id="wrapper" style="position: relative;"&gt;
        &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px"&gt;&lt;/div&gt;
        &lt;iframe src="http://www.stps.it/tratte/Details.aspx?id=219"&gt;&lt;/iframe&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div id="dropdown2" class="tab-pane fade"&gt;
    &lt;h3&gt;Orari Bus Italia - A3 CHIAVENNA - GORDONA - SAMOLACO&lt;/h3&gt;
    &lt;div id="wrapper" style="position: relative;"&gt;
        &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px"&gt;&lt;/div&gt;
        &lt;iframe src="http://www.stps.it/tratte/Details.aspx?id=216"&gt;&lt;/iframe&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="dropdown7" class="tab-pane fade"&gt;
        &lt;h3&gt;Orari Bus Italia - A4 CHIAVENNA - CAMPODOLCINO - MADESIMO&lt;/h3&gt;
        &lt;div id="wrapper" style="position: relative;"&gt;
            &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px"&gt;&lt;/div&gt;
            &lt;iframe src="http://www.stps.it/tratte/Details.aspx?id=215"&gt;&lt;/iframe&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="dropdown8" class="tab-pane fade"&gt;
            &lt;h3&gt;Orari Bus Italia - A5 CHIAVENNA - VILLA DI CHIAVENNA&lt;/h3&gt;
            &lt;div id="wrapper" style="position: relative;"&gt;
                &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px"&gt;&lt;/div&gt;
                &lt;iframe src="http://www.stps.it/tratte/Details.aspx?id=218"&gt;&lt;/iframe&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="dropdown9" class="tab-pane fade"&gt;
            &lt;h3&gt;Orari Bus Italia - A6 CHIAVENNA - OLMO&lt;/h3&gt;
            &lt;div id="wrapper" style="position: relative;"&gt;
                &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 100px"&gt;&lt;/div&gt;
                &lt;iframe src="http://www.stps.it/tratte/Details.aspx?id=214"&gt;&lt;/iframe&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="dropdown3" class="tab-pane fade"&gt;
            &lt;h3&gt;Chiavenna-St.Moritz&lt;/h3&gt;
            &lt;iframe src="https://goo.gl/2jgijH"&gt;&lt;/iframe&gt;
        &lt;/div&gt;
        &lt;div id="dropdown4" class="tab-pane fade"&gt;
            &lt;h3&gt;Chiavenna-Lugano&lt;/h3&gt;
            &lt;iframe src="https://goo.gl/EjMZs2"&gt;&lt;/iframe&gt;
        &lt;/div&gt;
        &lt;div id="dropdown5" class="tab-pane fade"&gt;
            &lt;h3&gt;Chiavenna - Colico - Milano&lt;/h3&gt;
            &lt;div id="wrapper" style="position: relative;"&gt;
                &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 1080px"&gt;&lt;/div&gt;
                &lt;iframe id="orariMilano"&gt;&lt;/iframe&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="dropdown6" class="tab-pane fade"&gt;
            &lt;h3&gt;Chiavenna - Colico - Sondrio&lt;/h3&gt;
            &lt;div id="wrapper" style="position: relative;"&gt;
                &lt;div id="block" style="position: absolute; top: 0; left: 0; width: 100%; height: 1080px"&gt;&lt;/div&gt;
                &lt;iframe id="orariSondrio"&gt;&lt;/iframe&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div id="sectionB" class="tab-pane fade"&gt;
            &lt;h3&gt;Informazioni turistiche&lt;/h3&gt;
            &lt;wr:Grid/&gt;
        &lt;/div&gt;
        &lt;div id="sectionA" class="tab-pane fade in active"&gt;
            &lt;h3&gt;Informazioni su come utilizzare il Totem&lt;/h3&gt;
            &lt;p&gt;Per utilizzare il Totem...&lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>