twitter/bootstrap — Issue #2123: btn-group and active class
Author: sams
Created: 2012-02-21 06:48:32+00:00
State: open

with radio and checkbox btn-groups the active class is not applied correctly when clicking radio/checkbox

instead of being applied to the clicked element the active class is applied to the btn-group.

toggle: function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
console.info(this.$element) // this should be button clicked but is btn-group
console.info($parent) // this should be btn-group but is blank
$parent && $parent
.find('.active')
.removeClass('active')

this.$element.toggleClass('active')
}

this.$element is the btn group and $parent is not found

this can be seen when clicking the single toggle example above the checkbox/radio examples

if I apply the active class manually then the checkbox/radio appears depressed

also as a thought would be be good to change actual checkboxes and radios into buttons with correct classes?