20151217jqueryui--Auto-Complete tool

Source: Internet
Author: User

Auto-completion (autocomplete) is a UI tool that reduces the user's ability to enter complete information. Generally in the loss
Enter the mailbox, search keywords, etc., and extract the corresponding complete string for the user to select.
A Call the AutoComplete () method

$ (' #email '). AutoComplete ({source: [' [email protected] ', ' [email protected] ', ' [email protected] '],});

Two Modify the AutoComplete () style
Because the AutoComplete () method is the pop-up window, then the mouse hovers over the style. We want to get to hover through Firebug
When the background of the style, you can directly through the jquery.ui.css inside find the corresponding CSS.

Instead of modifying the CSS in the UI, replace it directly with Style.css. Ui-menu-item a.ui-state-focus {background:url (. /img/ui_header_bg.png);}

Note: Other modification scenarios are similar.

Three Properties of the AutoComplete () method
There are two forms of the auto-complement method: 1.autocomplete (Options), the options are the parameters of the object key-value pairs,
Each key-value pair represents an option, 2.autocomplete (' action ', param), and the action is the character of the Action dialog box method
String, param is an option for options.


$ (' #email '). AutoComplete ({source: [' [email protected] ', ' [email protected] ', ' [email protected] '],disabled:false, Minlength:2,delay:50,autofocus:true,});

  

$ (' #email '). AutoComplete ({position: {my: ' Left center ', in: ' Right Center '}});

Four Events for the AutoComplete () method
In addition to property settings, the AutoComplete () method provides a number of events. These events can give a variety of different
Provides a callback function when the state is The This value in these callback functions equals the Div object of the dialog box content, not the entire dialog box
The Div.

$ (' #email '). AutoComplete ({source: [' [email protected] ', ' [email protected] ', ' [email protected] '],disabled:false, Minlength:1,delay:0,focus:function (E, UI) {ui.item.value = ' 123 ';},select:function (E, UI) {ui.item.value = ' 123 ' ;},change:function (E, UI) {alert (");},search:function (E, UI) {alert (");},});

  

Turn off auto-complete $ (' #email '). AutoComplete (' close ');//Disable Auto-complete $ (' #email '). AutoComplete (' disable ');//enable auto-complete $ (' #email '). AutoComplete (' Enable ');//delete auto-complete $ (' #email '). AutoComplete (' destroy ');//Get auto-complement JQuery object $ (' #email '). AutoComplete (' search$ (' #email '). AutoComplete (' Search ', ');//Gets the value of the Param option for an options var delay = $ (' #email '). AutoComplete (' option ', ' delay ');///Set the value of the Param option for the options $ (' #email '). Dialog (' option ', ' delay ', 0);

Five Use on () in AutoComplete
In the event of AutoComplete, an event method that is handled using the on () method is provided.

$ (' #reg '). On (' Autocompleteopen ', function () {alert (' triggered when open! ‘);});

  



20151217jqueryui--Auto-Complete tool

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.