Jquery AutoComplete User Manual

Source: Internet
Author: User

Jquery AutoComplete is a powerful automatic prompt plug-in similar to Google suggest. It can meet almost all our needs.

Http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete

Current version: 1.1
Jquery version: 1.2.6 +

The first is the most important method.

AutoComplete (URL or data,[Options])

The first parameter can be an array or URL. The options parameter is complex:

* Minchars (number ):

The number of characters that the user must enter before triggering autocomplete. Default: 1. If it is set to 0, double-click the input box or delete the content in the input box to display the list.

* Width (number ):

Width of the drop-down box. Default: width of the input element

* Max (number ):

AutoComplete drop-down shows the number of projects. Default: 10

* Delay (number ):

The delay time (in milliseconds) for activating AutoComplete after the key is clicked. Default: the remote value is 400 local 10

* AutoFill (Boolean ):

Do you want to automatically enter the user's current mouse value in the input box when the user selects it? default: false

* Mustmatch (booolean ):

If it is set to true, AutoComplete will only allow matching results to appear in the input box. If the user inputs illegal characters, the drop-down box will not be available. Default: false

* Matchcontains (Boolean ):

Determine whether to check the match within the string during comparison, for example, whether Ba matches the BA in Foo bar. It is important to use cache. Do not mix it with AutoFill. Default: false

* Selectfirst (Boolean ):

If it is set to true, the first value of the autocomplete drop-down list is automatically selected when you type the tab or return key, although it is not manually selected (with a keyboard or mouse ). of course, if you select a project, you can use the selected value. default: True

* Cachelength (number ):

The cache length, that is, the number of records to be cached in the result set obtained from the database. set to 1 as not cached. Default: 10

* Matchsubset (Boolean ):

AutoComplete can be used to cache server queries. If the query result of foo is cached, you do not need to retrieve Foo if you enter Foo. this option is usually enabled to reduce the burden on the server and improve performance. it is valid only when the cache length is greater than 1. default: True

* Matchcase (Boolean ):

Whether the case sensitivity switch is enabled for comparison. it is important to use the cache. if you understand the previous option, this is not difficult to understand, just like whether foot needs to be searched in the foo cache. default: false

* Multiple (Boolean ):

Whether multiple values can be input. That is, multiple AutoComplete values can be used to input multiple values. Default: false

* Multipleseparator (string ):

If multiple characters are selected, they are used to separate the selected characters. Default :","

* Scroll (Boolean ):

Whether to use Scroll display when the result set is larger than the default height default: True

* Scrollheight (number ):

The scroll height of the Automatic completion prompt is expressed in pixels by default: 180

* Formatitem (function ):

Use advanced labels for each project to be displayed. this function is called for each row in the result. The returned value is contained in the Li element and displayed in the drop-down list. autocompleter will provide three parameters (row, I, max): The returned result array, the number of rows processed currently (that is, the number of items, which is a natural number starting from 1 ), the number of elements in the current result array is the number of items. default: None, indicating that no custom processing function is specified, so that each row in the drop-down list contains only one value.

* Formatresult (function ):

Similar to formatitem, You Can format the value to be entered in the input text box. there are also three parameters, the same as formatitem. default: None, which indicates either data only or the value provided by formatitem.

* Formatmatch (function ):

Use this function to format the data format to be queried for each row of data. The returned value is for internal search.AlgorithmUsed. Parameter Value row

* Extraparams (object ):

Provides more parameters for the backend (generally server scripts. like the common practice, a key-Value Pair object is used. if the passed value is {bar: 4}, it will be parsed into my_autocomplete_backend.php by autocompleter? Q = Foo & bar = 4 (assuming the current user has entered Foo). Default :{}

 

Result (handler, item)

The selected event. Item is the selected phase.

For example, we can directly jump to the page after selection:

1 VaR Data = [{Text: ' Link ' , URL: ' /Page1 ' }, {Text: ' Link B ' , URL: ' /Page2 ' }];
2 $ ( " ... " ). AutoComplete (data ,{
3 Formatitem: Function (Item ){
4 Return Item. text;
5 }
6 }). Result ( Function (Event, item ){
7 Location. href = Item. url;
8 });
9

 

 

Document address: http://docs.jquery.com/Plugins/Autocomplete#API_Documentation

 

 

 

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.