aboutsummaryrefslogtreecommitdiffstats
path: root/demos/autocomplete/combobox.html
diff options
context:
space:
mode:
Diffstat (limited to 'demos/autocomplete/combobox.html')
-rw-r--r--demos/autocomplete/combobox.html16
1 files changed, 12 insertions, 4 deletions
diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html
index 5fbb64d05..37bb0c179 100644
--- a/demos/autocomplete/combobox.html
+++ b/demos/autocomplete/combobox.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Combobox</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.3.js"></script>
+ <script src="../../jquery-1.4.4.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
@@ -24,7 +24,7 @@
select = this.element.hide(),
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "";
- var input = $( "<input>" )
+ var input = this.input = $( "<input>" )
.insertAfter( select )
.val( value )
.autocomplete({
@@ -58,7 +58,7 @@
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
valid = false;
select.children( "option" ).each(function() {
- if ( this.value.match( matcher ) ) {
+ if ( $( this ).text().match( matcher ) ) {
this.selected = valid = true;
return false;
}
@@ -67,6 +67,7 @@
// remove invalid value, as it didn't match anything
$( this ).val( "" );
select.val( "" );
+ input.data( "autocomplete" ).term = "";
return false;
}
}
@@ -81,7 +82,7 @@
.appendTo( ul );
};
- $( "<button>&nbsp;</button>" )
+ this.button = $( "<button type='button'>&nbsp;</button>" )
.attr( "tabIndex", -1 )
.attr( "title", "Show All Items" )
.insertAfter( input )
@@ -104,6 +105,13 @@
input.autocomplete( "search", "" );
input.focus();
});
+ },
+
+ destroy: function() {
+ this.input.remove();
+ this.button.remove();
+ this.element.show();
+ $.Widget.prototype.destroy.call( this );
}
});
})( jQuery );