bootstrap accordion only one open at a time code example

Example: open one accordion at a time bootstrap

Notice that each panel has a data-parent which targets the parent div with the 
ID #panels.

<div class="panel-group" id="panels">
    <div class="panel panel-default">
        <div class="collapsed" data-toggle="collapse" data-parent="#panels" data-target="#firstPanel">
             <h4>First header</h4>    
        </div>
        <div id="firstPanel" class="panel-collapse collapse">
            <div>Content.</div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="collapsed" data-toggle="collapse" data-parent="#panels" data-target="#secondPanel">
             <h4>Second header</h4>

        </div>
        <div id="secondPanel" class="panel-collapse collapse">
            <div>Other content.</div>
        </div>
    </div>
</div>

Tags:

Misc Example