I thought there was only one - included in jQuery UI and documented here.
I know there are third-party autocomplete widgets that plug-in to jQuery, like the one from devbridge. But I would describe that as an autocomplete widget for jQuery, rather than the jQuery autocomplete widget.
But on Stackoverflow, I see questions asking about an autocomplete widget that does not use the syntax described in the jQuery UI documentation. For example:
The jQuery UI syntax looks like this:
$("#input1").autocomplete({
source: function(req, responseFn) {
...
},
select: function(value, data){
...
}
});
Whereas some of those other questions hae a syntax like this:
$("#city").autocomplete("CUList.asmx/GetCUList", {
dataType: 'jsonp',
parse: function(data)
{
var rows = new Array();
for(var i=0; i<data.length; i++){
rows[i] = { data:data[i], value:data[i].CUName, result:data[i].CUName };
}
return rows;
},
formatItem: function(row, i, n) {
return row.CUName + ', ' + row.CUCity;
},
max: 50
});
What's the explanation for the discrepancy? People ask about "jquery autocomplete" without specifying which one. With no direction, shouldn't I assume THE jquery UI autocomplete?
Advertisements. Auto completion is a mechanism frequently used in modern websites to provide the user with a list of suggestions for the beginning of the word, which he/she has typed in a text box. The user can then select an item from the list, which will be displayed in the input field.
a jQuery UI widget is a specialized jQuery plug-in. Using plug-in, we can apply behaviours to the elements. However, plug-ins lack some built-in capabilities, such as a way to associate data with its elements, expose methods, merge options with defaults, and control the plug-in's lifetime.
Autocomplete mechanism is frequently used in modern websites to provide the users a list of suggestion while typing the beginning word in the text box. It facilitates the user to select an item from the list, which will be displayed in the input field.
Syntax: $("TagId"). autocomplete({ source : itemList // List of Words. })
ANSWER
There are numerous autocomplete widgets that work with jQuery.
There is a habit that is fairly common among users of jquery plugins, when asking questions on SO, to not identify which particular widget they are using. People use phrases like "the jquery autocomplete widget" when they really are referring to "a jquery autocomplete widget".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With