The Problem

For some reason the Bootstrap 3 btn-group class doesn’t keep buttons selected by default (at least in 3.0.2).  It’s strange that this behavior isn’t easily configurable since I don’t think my use case is uncommon, but oh well.  Here is a jsfiddle demonstrating the problem.

 

The Solution

Basically you need to use jQuery’s on function to attach a click listener to each button within a btn-group. In the even handler:

  1. apply the Bootstrap .active class
  2. remove the class from any of its siblings (assuming you want button selection to be mutually-exclusive).