aboutsummaryrefslogtreecommitdiff
path: root/js/button.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/button.js')
-rw-r--r--js/button.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/js/button.js b/js/button.js
index c29647840..c0127cc5f 100644
--- a/js/button.js
+++ b/js/button.js
@@ -53,10 +53,11 @@
}
Button.prototype.toggle = function () {
- var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
- if ($parent) {
- $parent.find('.active').removeClass('active')
+ if ($parent.length) {
+ var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active'))
+ if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
}
this.$element.toggleClass('active')
@@ -98,6 +99,7 @@
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
+ if ($btn.has('input').length) return // throw away double event for inputs
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})