JQuery AutoComplete use manual _jquery

Source: Internet
Author: User
Official website: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete
Current Version: 1.1
jquery version required: 1.2.6+
The first is the most important method
AutoComplete (URL or data, [options])
The first argument can be either an array or a URL. Options parameters are more complex:
* Minchars (number):
The number of characters that the user needs to enter at least before triggering the AutoComplete. Default:1, if set to 0, double click in the input box or delete the contents of the input box to display the list
* Width (number):
Specifies the width of the Drop-down box. Width of default:input element
* MAX (number):
AutoComplete Drop-down Displays the number of items. default:10
* Delay (number):
The delay time (in milliseconds) to activate AutoComplete after a keystroke. Default: Remote for 400 local 10
* AutoFill (Boolean):
To automatically fill the input box with the value of the user's current mouse when the user chooses. Default:false
* Mustmatch (Booolean):
If set to True,autocomplete will only allow matching results to appear in the input box, all when the user entered an illegal character will not get the Drop-down box. Default:false
* Matchcontains (Boolean):
Determines whether a match is to be viewed inside a string when comparing, such as whether BA matches the BA in Foo Bar. It is important to use caching. Don't mix with autofill. Default:false
* Selectfirst (Boolean):
If set to True, the first value of the AutoComplete drop-down list is automatically selected when the user types the tab or return key, although it is not manually selected (with the keyboard or mouse). Of course, if a user selects an item, the user selects the value. Default:true
* Cachelength (number):
The length of the cache. That is, how many records to cache for a result set fetched from the database. Set to 1 is not cached. default:10
* Matchsubset (Boolean):
AutoComplete can you use caching for server queries, and if you cache query results for Foo, you don't need to retrieve them if you enter Foo? Use caching directly. This option is usually turned on to reduce the burden on the server to improve performance. will only be valid if the cache length is greater than 1 o'clock. Default:true
* MatchCase (Boolean):
Compare whether the case sensitive switch is turned on. It is important to use caching. If you understand an option, this is not difficult to understand, just like foot to the cache of Foo. Default:false
* Multiple (Boolean):
Whether to allow multiple values to be entered is to use AutoComplete multiple times to enter multiple values. Default:false
* Multipleseparator (String):
When multiple selections are used, separate the characters from each selection. Default: ","
* Scroll (Boolean):
Whether the scroll display is used when the result set is greater than the default height default:true
* ScrollHeight (number):
The scroll height of the auto completion prompt is expressed in pixel size default:180
* Formatitem (Function):
Use the advanced label for each item you want to display. This function is called for each row in the result, and the return value is displayed in the Drop-down list with the LI element. Autocompleter will provide three parameters (row, I, max): The returned array of results, the number of rows currently processed (that is, the first few items, the natural number starting from 1), and the number of the current result array elements, which is the number of items. Default:none, which means that no custom handler function is specified, so that each row in the Drop-down list contains only one value.
* FormatResult (Function):
Similar to Formatitem, but you can format the values that you want to enter into the input text box. There are also three parameters, like Formatitem. Default:none, which means either only data, or values supplied with Formatitem.
* Formatmatch (Function):
Use this function for each row of data to format the data that you want to query. The return value is used for the internal search algorithm. Parameter Value row
* Extraparams (Object):
Provides additional parameters for the background (typically the server-side script). As is often the case, a key value pair object is used. If the pass value is {Bar:4}, it will be autocompleter parsed into My_autocomplete_backend.php?q=foo &bar=4 (assuming the current user has entered Foo). Default: {}

Result (handler, item)
The event that is triggered when selected. Item is the selected phase.
For example, we can jump directly to the page after we select it:
Copy Code code as follows:

var data = [{text: ' link A ', url: '/page1 '}, {text: ' link B ', url: '/page2 '}];
$ ("..."). AutoComplete (data, {
Formatitem:function (item) {
return item.text;
}
). Result (Function (event, item) {
Location.href = Item.url;
});

Document Address: Http://docs.jquery.com/Plugins/Autocomplete

Use instance code:
Jquery AutoComplete An example of how to use it automatically

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.