Skip to content
Permalink
Browse files

Autocomplete: Combobox demo - Collapse menu when clicking button.

  • Loading branch information...
scottgonzalez committed Dec 13, 2012
1 parent 1f5dd8d commit f6e99d2021bf9865673d08a4cef4d67ba7c586a5
Showing with 7 additions and 7 deletions.
  1. +7 −7 demos/autocomplete/combobox.html
@@ -39,6 +39,7 @@
_create: function() {
var input,
that = this,
wasOpen = false,
select = this.element.hide(),
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "",
@@ -129,20 +130,19 @@
})
.removeClass( "ui-corner-all" )
.addClass( "ui-corner-right ui-combobox-toggle" )
.mousedown(function() {
wasOpen = input.autocomplete( "widget" ).is( ":visible" );
})
.click(function() {
input.focus();
// close if already visible
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
input.autocomplete( "close" );
removeIfInvalid( input );
if ( wasOpen ) {
return;
}
// work around a bug (likely same cause as #5265)
$( this ).blur();
// pass empty string as value to search for, displaying all results
input.autocomplete( "search", "" );
input.focus();
});
input.tooltip({

0 comments on commit f6e99d2

Please sign in to comment.
You can’t perform that action at this time.