diff options
| author | Mark Otto <[email protected]> | 2013-07-18 01:25:28 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-07-18 01:25:28 -0700 |
| commit | 6e04925328c74dde8d98676b5148d646ea055e9b (patch) | |
| tree | afe6d9aef724184db7c893b6d324519b729d3fc9 /js/button.js | |
| parent | e72b524d416a5b3352274e0d748ffd77ceecf100 (diff) | |
| parent | 6ec8a1e44f6b58ed57d015916a4fe39bfb0e2340 (diff) | |
| download | bootstrap-6e04925328c74dde8d98676b5148d646ea055e9b.tar.xz bootstrap-6e04925328c74dde8d98676b5148d646ea055e9b.zip | |
Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip
Diffstat (limited to 'js/button.js')
| -rw-r--r-- | js/button.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/js/button.js b/js/button.js index c29647840..b4d66b68b 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') @@ -100,6 +101,7 @@ var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') + e.preventDefault() }) }(window.jQuery); |
