summaryrefslogtreecommitdiffstats
path: root/demos/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'demos/autocomplete')
-rw-r--r--demos/autocomplete/categories.html2
-rw-r--r--demos/autocomplete/combobox.html19
-rw-r--r--demos/autocomplete/custom-data.html2
-rw-r--r--demos/autocomplete/default.html2
-rw-r--r--demos/autocomplete/folding.html2
-rw-r--r--demos/autocomplete/images/jquery_32x32.pngbin4288 -> 1417 bytes
-rw-r--r--demos/autocomplete/images/jqueryui_32x32.pngbin3944 -> 1193 bytes
-rw-r--r--demos/autocomplete/images/sizzlejs_32x32.pngbin3750 -> 999 bytes
-rw-r--r--demos/autocomplete/images/transparent_1x1.pngbin137 -> 95 bytes
-rw-r--r--demos/autocomplete/images/ui-anim_basic_16x16.gifbin1553 -> 1459 bytes
-rw-r--r--demos/autocomplete/maxheight.html2
-rw-r--r--demos/autocomplete/multiple-remote.html64
-rw-r--r--demos/autocomplete/multiple.html56
-rw-r--r--demos/autocomplete/remote-jsonp.html2
-rw-r--r--demos/autocomplete/remote-with-cache.html2
-rw-r--r--demos/autocomplete/remote.html2
-rw-r--r--demos/autocomplete/xml.html2
17 files changed, 92 insertions, 65 deletions
diff --git a/demos/autocomplete/categories.html b/demos/autocomplete/categories.html
index 494445b25..28f3ef18f 100644
--- a/demos/autocomplete/categories.html
+++ b/demos/autocomplete/categories.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Categories</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html
index ed9b0d5a2..5bef5b1af 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.4.js"></script>
+ <script src="../../jquery-1.5.1.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 )
@@ -100,10 +101,20 @@
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();
});
+ },
+
+ destroy: function() {
+ this.input.remove();
+ this.button.remove();
+ this.element.show();
+ $.Widget.prototype.destroy.call( this );
}
});
})( jQuery );
diff --git a/demos/autocomplete/custom-data.html b/demos/autocomplete/custom-data.html
index 9b6a2e6d4..d619a4f81 100644
--- a/demos/autocomplete/custom-data.html
+++ b/demos/autocomplete/custom-data.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Custom data and display</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/default.html b/demos/autocomplete/default.html
index 2f1495925..16ec893d4 100644
--- a/demos/autocomplete/default.html
+++ b/demos/autocomplete/default.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/folding.html b/demos/autocomplete/folding.html
index 5a06faa23..688db3356 100644
--- a/demos/autocomplete/folding.html
+++ b/demos/autocomplete/folding.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Accent folding</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/images/jquery_32x32.png b/demos/autocomplete/images/jquery_32x32.png
index 1cd42c9fe..9312f02d5 100644
--- a/demos/autocomplete/images/jquery_32x32.png
+++ b/demos/autocomplete/images/jquery_32x32.png
Binary files differ
diff --git a/demos/autocomplete/images/jqueryui_32x32.png b/demos/autocomplete/images/jqueryui_32x32.png
index 23ca0f8b9..e003d16c1 100644
--- a/demos/autocomplete/images/jqueryui_32x32.png
+++ b/demos/autocomplete/images/jqueryui_32x32.png
Binary files differ
diff --git a/demos/autocomplete/images/sizzlejs_32x32.png b/demos/autocomplete/images/sizzlejs_32x32.png
index 8d7ae1e0b..4ce0704d1 100644
--- a/demos/autocomplete/images/sizzlejs_32x32.png
+++ b/demos/autocomplete/images/sizzlejs_32x32.png
Binary files differ
diff --git a/demos/autocomplete/images/transparent_1x1.png b/demos/autocomplete/images/transparent_1x1.png
index 209a43864..c2da5b889 100644
--- a/demos/autocomplete/images/transparent_1x1.png
+++ b/demos/autocomplete/images/transparent_1x1.png
Binary files differ
diff --git a/demos/autocomplete/images/ui-anim_basic_16x16.gif b/demos/autocomplete/images/ui-anim_basic_16x16.gif
index 085ccaeca..084ecb879 100644
--- a/demos/autocomplete/images/ui-anim_basic_16x16.gif
+++ b/demos/autocomplete/images/ui-anim_basic_16x16.gif
Binary files differ
diff --git a/demos/autocomplete/maxheight.html b/demos/autocomplete/maxheight.html
index 7e0e0f903..fc0b4840c 100644
--- a/demos/autocomplete/maxheight.html
+++ b/demos/autocomplete/maxheight.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Scrollable results</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html
index cfbf56fe1..c82188a94 100644
--- a/demos/autocomplete/multiple-remote.html
+++ b/demos/autocomplete/multiple-remote.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Multiple, remote</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
@@ -22,35 +22,43 @@
return split( termĀ ).pop();
}
- $( "#birds" ).autocomplete({
- source: function( request, response ) {
- $.getJSON( "search.php", {
- term: extractLast( request.term )
- }, response );
- },
- search: function() {
- // custom minLength
- var term = extractLast( this.value );
- if ( term.length < 2 ) {
+ $( "#birds" )
+ // don't navigate away from the field on tab when selecting an item
+ .bind( "keydown", function( event ) {
+ if ( event.keyCode === $.ui.keyCode.TAB &&
+ $( this ).data( "autocomplete" ).menu.active ) {
+ event.preventDefault();
+ }
+ })
+ .autocomplete({
+ source: function( request, response ) {
+ $.getJSON( "search.php", {
+ term: extractLast( request.term )
+ }, response );
+ },
+ search: function() {
+ // custom minLength
+ var term = extractLast( this.value );
+ if ( term.length < 2 ) {
+ return false;
+ }
+ },
+ focus: function() {
+ // prevent value inserted on focus
+ return false;
+ },
+ select: function( event, ui ) {
+ var terms = split( this.value );
+ // remove the current input
+ terms.pop();
+ // add the selected item
+ terms.push( ui.item.value );
+ // add placeholder to get the comma-and-space at the end
+ terms.push( "" );
+ this.value = terms.join( ", " );
return false;
}
- },
- focus: function() {
- // prevent value inserted on focus
- return false;
- },
- select: function( event, ui ) {
- var terms = split( this.value );
- // remove the current input
- terms.pop();
- // add the selected item
- terms.push( ui.item.value );
- // add placeholder to get the comma-and-space at the end
- terms.push( "" );
- this.value = terms.join( ", " );
- return false;
- }
- });
+ });
});
</script>
</head>
diff --git a/demos/autocomplete/multiple.html b/demos/autocomplete/multiple.html
index 33f0ad834..954016d75 100644
--- a/demos/autocomplete/multiple.html
+++ b/demos/autocomplete/multiple.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Multiple values</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
@@ -43,29 +43,37 @@
return split( term ).pop();
}
- $( "#tags" ).autocomplete({
- minLength: 0,
- source: function( request, response ) {
- // delegate back to autocomplete, but extract the last term
- response( $.ui.autocomplete.filter(
- availableTags, extractLast( request.term ) ) );
- },
- focus: function() {
- // prevent value inserted on focus
- return false;
- },
- select: function( event, ui ) {
- var terms = split( this.value );
- // remove the current input
- terms.pop();
- // add the selected item
- terms.push( ui.item.value );
- // add placeholder to get the comma-and-space at the end
- terms.push( "" );
- this.value = terms.join( ", " );
- return false;
- }
- });
+ $( "#tags" )
+ // don't navigate away from the field on tab when selecting an item
+ .bind( "keydown", function( event ) {
+ if ( event.keyCode === $.ui.keyCode.TAB &&
+ $( this ).data( "autocomplete" ).menu.active ) {
+ event.preventDefault();
+ }
+ })
+ .autocomplete({
+ minLength: 0,
+ source: function( request, response ) {
+ // delegate back to autocomplete, but extract the last term
+ response( $.ui.autocomplete.filter(
+ availableTags, extractLast( request.term ) ) );
+ },
+ focus: function() {
+ // prevent value inserted on focus
+ return false;
+ },
+ select: function( event, ui ) {
+ var terms = split( this.value );
+ // remove the current input
+ terms.pop();
+ // add the selected item
+ terms.push( ui.item.value );
+ // add placeholder to get the comma-and-space at the end
+ terms.push( "" );
+ this.value = terms.join( ", " );
+ return false;
+ }
+ });
});
</script>
</head>
diff --git a/demos/autocomplete/remote-jsonp.html b/demos/autocomplete/remote-jsonp.html
index ab14bcd14..04b44fd5c 100644
--- a/demos/autocomplete/remote-jsonp.html
+++ b/demos/autocomplete/remote-jsonp.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote JSONP datasource</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/remote-with-cache.html b/demos/autocomplete/remote-with-cache.html
index 1f4cce74b..b1b7c8b37 100644
--- a/demos/autocomplete/remote-with-cache.html
+++ b/demos/autocomplete/remote-with-cache.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote with caching</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/remote.html b/demos/autocomplete/remote.html
index de8062100..992a5867d 100644
--- a/demos/autocomplete/remote.html
+++ b/demos/autocomplete/remote.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - Remote datasource</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
diff --git a/demos/autocomplete/xml.html b/demos/autocomplete/xml.html
index ca338716b..751059455 100644
--- a/demos/autocomplete/xml.html
+++ b/demos/autocomplete/xml.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>jQuery UI Autocomplete - XML data parsed once</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.4.4.js"></script>
+ <script src="../../jquery-1.5.1.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>