diff options
| author | Mark Otto <[email protected]> | 2013-11-16 22:02:59 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-11-16 22:02:59 -0800 |
| commit | 03501f9c4afc3a74bba958c388b32e5ac065e997 (patch) | |
| tree | 2590291a248334d167245b6c95b36ea7a7b9ae64 /js/button.js | |
| parent | 86678e66021657cf7d59a96b9cf0fe0cb42ee968 (diff) | |
| parent | ae4d5f21a96fab3691ca33e9e3747a01c467e10e (diff) | |
| download | bootstrap-03501f9c4afc3a74bba958c388b32e5ac065e997.tar.xz bootstrap-03501f9c4afc3a74bba958c388b32e5ac065e997.zip | |
Merge branch 'master' into docs_derp
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 14 |
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') } |
