bootstrap
bootstrap copied to clipboard
Suggestion: Button plugin should send a change event when selection in a radiogroup changes
Problem I cannot hook up to the "change" event for radiobuttons in a data-toggle="buttons" element. This is because the event does not trigger when setting the 'checked' property with .prop().
Solution Actively send the change event when the property is changed.
The code (in buttons.js, line 59)
var $input = this.$element.find('input')
.prop('checked', !this.$element.hasClass('active'))
.trigger('change') // this line is new