Jquery automatically supplements the search result prompt when imitating Baidu and Google Search

Source: Internet
Author: User

A good program is a favorite program. Good programmers are lazy programmers. Yesterday I studied Jquery's prompt to automatically add search results when imitating Baidu and Google searches, and I felt that the results were okay. I would like to share it with you. Jquery plug-in. See the Code:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
$ (). Ready (function (){

$ (": Text"). result (auto );

Function auto (data ){
$ ("# KeyWord"). val (data. name );
}

$ ("# KeyWord"). autocomplete (obj, {// obj is the data object array Json
MinChars: 0, // indicates the minimum character that is entered before automatic activation is completed.
Max: 5, // indicates the number of entries in the list
AutoFill: true, // indicates Automatic Filling
MustMatch: false, // indicates that the entry must be matched. The content entered in the text box must be the data in the data parameter. If the content does not match, the text box is cleared.
MatchContains: true, // indicates include match, which is equivalent to fuzzy match.
ScrollHeight: 200, // indicates the display height of the list. The default height is 180.

FormatItem: function (row ){
Return row. name;
},
FormatMatch: function (row ){
Return row. name;
},
FormatResult: function (row ){
Return row. value;
}
});
});
</Script>

Jsp:
Copy codeThe Code is as follows:
<Div>
<H4> imitating BaiDu, google Search Prompt <Table>
<Tr> <td> name: <input type = "text" id = "keyWord"/> </td> </tr>
</Table>
</Div>

Related Article

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.