BS3 - Toggle Div By Click
by bizamajig
HTML
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="btn-group mytoggle" data-toggle="buttons">
<button type="button" title="left" class="btn btn-info active">left</button>
<button type="button" title="right" class="btn btn-info">right</button>
</div>
<div class="btn-group" data-toggle="buttons">
<button type="button" title="a" class="btn btn-info">dont toggle</button>
<button type="button" title="b" class="btn btn-info">another function</button>
</div>
<div id="left"> LEFT CONTENT </div>
<div id="right"> RIGHT CONTENT </div>
CSS
#right { display:none; }
JavaScript
$('.mytoggle button').click(function(){
var ix = $(this).index();
$('#left').toggle( ix === 0 );
$('#right').toggle( ix === 1 );
});