aboutsummaryrefslogtreecommitdiff
path: root/js/button.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2013-11-30 00:26:53 -0800
committerMark Otto <[email protected]>2013-11-30 00:26:53 -0800
commitbb4a39d51cd644b212323a7e36f0b5af2682d0ca (patch)
tree60ae6687f516cea501f32f5623a5c0aacb950772 /js/button.js
parent96109d3138fd6f5b67fb1108754e81c077630b36 (diff)
parente6eb798178529cf58fab3f33446c0170bae7bdea (diff)
downloadbootstrap-bb4a39d51cd644b212323a7e36f0b5af2682d0ca.tar.xz
bootstrap-bb4a39d51cd644b212323a7e36f0b5af2682d0ca.zip
Merge branch 'master' into pr/11388
Conflicts: dist/css/bootstrap.min.css
Diffstat (limited to 'js/button.js')
-rw-r--r--js/button.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/js/button.js b/js/button.js
index 0145689dd..3c1613506 100644
--- a/js/button.js
+++ b/js/button.js
@@ -54,15 +54,21 @@
Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons"]')
+ var changed = true
if ($parent.length) {
var $input = this.$element.find('input')
- .prop('checked', !this.$element.hasClass('active'))
- .trigger('change')
- if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
+ if ($input.prop('type') === 'radio') {
+ // see if clicking on current one
+ if ($input.prop('checked') && this.$element.hasClass('active'))
+ changed = false
+ else
+ $parent.find('.active').removeClass('active')
+ }
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}
- this.$element.toggleClass('active')
+ if (changed) this.$element.toggleClass('active')
}