mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-06 13:46:42 +02:00
get button js working with actual form elements p cooll
This commit is contained in:
@@ -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')
|
||||
})
|
||||
|
Reference in New Issue
Block a user