aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/button.js2
-rw-r--r--js/tests/unit/button.js24
2 files changed, 13 insertions, 13 deletions
diff --git a/js/button.js b/js/button.js
index c0127cc5f..b4d66b68b 100644
--- a/js/button.js
+++ b/js/button.js
@@ -99,9 +99,9 @@
$(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')
+ e.preventDefault()
})
}(window.jQuery);
diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js
index 06ef36fc1..0f8988a7d 100644
--- a/js/tests/unit/button.js
+++ b/js/tests/unit/button.js
@@ -81,19 +81,19 @@ $(function () {
})
test("should check for closest matching toggle", function () {
- var group = '<div class="btn-group" data-toggle="buttons"> \
- <label class="btn btn-primary active"> \
- <input type="radio" name="options" id="option1" checked="true"> Option 1 \
- </label> \
- <label class="btn btn-primary"> \
- <input type="radio" name="options" id="option2"> Option 2 \
- </label> \
- <label class="btn btn-primary"> \
- <input type="radio" name="options" id="option3"> Option 3 \
- </label> \
- </div>'
+ var group = '<div class="btn-group" data-toggle="buttons">' +
+ '<label class="btn btn-primary active">' +
+ '<input type="radio" name="options" id="option1" checked="true"> Option 1' +
+ '</label>' +
+ '<label class="btn btn-primary">' +
+ '<input type="radio" name="options" id="option2"> Option 2' +
+ '</label>' +
+ '<label class="btn btn-primary">' +
+ '<input type="radio" name="options" id="option3"> Option 3' +
+ '</label>' +
+ '</div>'
- var group = $(group)
+ group = $(group)
var btn1 = $(group.children()[0])
var btn2 = $(group.children()[1])