In twitter bootstrap, I was looking for a way to allow a button to be the default color when not active. Once a button is active, I wanted to change the color of it. I looked at ways of doing it with the js file that was provided. I ended up writting a little script to handle this.
Share
By adding
class-toggleas an attribute to the button equaling what you would like to go to once the button is pressed and adding the following jQuery, you will get the result described above.Then the button would look like
If you want to do it with a button group as well it works the same way. Just add the
class-toggleto each button in the group.The jsfiddle
UPDATE
I have modified and created a gist to have a better response when starting you button with a class. Toggle Twitter Bootstrap Classes
UPDATE
I have made a change to fix the bug that appears when you click on an active radio button
Find it here