aboutsummaryrefslogtreecommitdiffstats
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.html16
-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.html6
-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, 93 insertions, 65 deletions
diff --git a/demos/autocomplete/categories.html b/demos/autocomplete/categories.html
index 69abea37f..494445b25 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.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.position.js"></script>
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 );
diff --git a/demos/autocomplete/custom-data.html b/demos/autocomplete/custom-data.html
index 6cdb5519b..9b6a2e6d4 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.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.position.js"></script>
diff --git a/demos/autocomplete/default.html b/demos/autocomplete/default.html
index bc6a20988..2f1495925 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.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.position.js"></script>
diff --git a/demos/autocomplete/folding.html b/demos/autocomplete/folding.html
index 0dd1f8a72..5a06faa23 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.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.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 e71b38ec9..7e0e0f903 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.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.position.js"></script>
@@ -14,6 +14,10 @@
.ui-autocomplete {
max-height: 100px;
overflow-y: auto;
+ /* prevent horizontal scrollbar */
+ overflow-x: hidden;
+ /* add padding to account for vertical scrollbar */
+ padding-right: 20px;
}
/* IE 6 doesn't support max-height
* we use height instead, but this forces the menu to always be this tall
diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html
index abe028ce6..9494da98a 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.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.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 c015cb9ef..44e6971e5 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.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.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 3fda8b7c0..ab14bcd14 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.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.position.js"></script>
diff --git a/demos/autocomplete/remote-with-cache.html b/demos/autocomplete/remote-with-cache.html
index dee94993a..1f4cce74b 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.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.position.js"></script>
diff --git a/demos/autocomplete/remote.html b/demos/autocomplete/remote.html
index b6f984630..de8062100 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.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.position.js"></script>
diff --git a/demos/autocomplete/xml.html b/demos/autocomplete/xml.html
index 6d054d6a4..ca338716b 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.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.position.js"></script>