1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-23 09:41:11 +00:00

prevent dropdowns from closing when clicking inside form element inside dropdown

This commit is contained in:
Jacob Thornton 2012-03-19 23:13:55 -07:00
parent 63bd7cb478
commit 663e41d74f
5 changed files with 12 additions and 6 deletions

Binary file not shown.

View File

@ -86,7 +86,9 @@
$(function () { $(function () {
$('html').on('click.dropdown.data-api', clearMenus) $('html').on('click.dropdown.data-api', clearMenus)
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) $('body')
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
}) })
}( window.jQuery ); }( window.jQuery );

View File

@ -39,8 +39,9 @@
, select: function () { , select: function () {
var val = this.$menu.find('.active').attr('data-value') var val = this.$menu.find('.active').attr('data-value')
this.$element.val(val) this.$element
this.$element.change(); .val(val)
.change()
return this.hide() return this.hide()
} }

View File

@ -86,7 +86,9 @@
$(function () { $(function () {
$('html').on('click.dropdown.data-api', clearMenus) $('html').on('click.dropdown.data-api', clearMenus)
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) $('body')
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
}) })
}( window.jQuery ); }( window.jQuery );

View File

@ -39,8 +39,9 @@
, select: function () { , select: function () {
var val = this.$menu.find('.active').attr('data-value') var val = this.$menu.find('.active').attr('data-value')
this.$element.val(val) this.$element
this.$element.change(); .val(val)
.change()
return this.hide() return this.hide()
} }