Multiple Toggles Almost like Tabs JavaScript/ CSS
<p>I want to create tabs that function like toggles, but instead only one toggle can be active at one time. The content of the tab also needs to be above the the tabs themselves. The problem is I am using a loop to generate the content as well as the tabs themselves. </p>

<p>I've got a nice javascript code right here that works perfectly fine. I understand this perfectly as well. The only problem is that it obviously doesn't disable other toggles when another one is clicked. Also having one "tab" / "toggle" always active. Code that could probably check the div id with a prefix of "post" and make all div id's with "post" to display:none besides the one that was clicked on. That would be perfect if that could be possible. Another way I could think of this is putting all the generated content into a container, and it simply disables all id's in the container besides the one that was clicked. </p>

<p>If this code can be modified to achieve that, it would be great. This is some very simple code that I understand very clearly. All I need is that it behaves more like tabs where only one can be active at once. </p>

<pre><code>&lt;script type="text/javascript"&gt;
function toggleMeMirror(a){
    var e=document.getElementById(a);
    if(!e) return true;
    if(e.style.display=="none"){
        e.style.display="inline"
    } else {
        e.style.display="none"
    }
    return true;
}
&lt;/script&gt;
</code></pre>

<p>HTML / PHP </p>

<p>Loop 1 - The Content </p>

<pre><code>&lt;?php while ($queryepisodemirrors-&gt;have_posts()) : $queryepisodemirrors-&gt;the_post(); ?&gt;
        &lt;?php if(get_post_meta(get_the_ID(), 'parentIDmirror', true) == $postIDCheck) { ?&gt;

        &lt;div id="post-&lt;?php the_ID(); ?&gt;" style="display:none;"&gt;
                    &lt;center&gt;&lt;?php the_title(); ?&gt;&lt;br /&gt;&lt;br /&gt;
                    &lt;?php echo get_post_meta(get_the_ID(), 'mirror_embed_code', true); ?&gt;
                    &lt;?php wprp(true);?&gt;
                &lt;/center&gt;
        &lt;/div&gt;  
        &lt;?php } ?&gt;
&lt;?php endwhile; ?&gt;
</code></pre>

<p>Loop 2 - The actual toggles / tabs</p>

<pre><code>&lt;?php while ($queryepisodemirrors-&gt;have_posts()) : $queryepisodemirrors-&gt;the_post(); ?&gt;
        &lt;?php if(get_post_meta(get_the_ID(), 'parentIDmirror', true) == $postIDCheck) { ?&gt;
        &lt;div style="float: left; padding: 4px;"&gt;
        &lt;center&gt;



        &lt;div class="post-&lt;?php the_ID(); ?&gt;" onclick="return toggleMeMirror('post-&lt;?php the_ID(); ?&gt;')" &gt;
            &lt;div style="overflow: hidden; width: 150px; height: 100px;"&gt;
                &lt;div style="background: rgb(0, 0, 0) transparent; /* fallback color */ background: rgba(0, 0, 0, 0.8); color: white; padding: 2px;"&gt;
                    &lt;center&gt;

                        &lt;?php echo get_post_meta(get_the_ID(), 'video_provider', true);
                        echo ' Mirror';?&gt;
                    &lt;/center&gt;
                &lt;/div&gt;
                &lt;img src="&lt;?php echo $thumbnail_src; ?&gt;" width="150px"/&gt;

            &lt;/div&gt;
        &lt;/div&gt;


        &lt;/center&gt;
        &lt;/div&gt;

        &lt;?php } ?&gt;
&lt;?php endwhile; ?&gt;
</code></pre>
