jquery imitate Baidu, Google search automatically add search results prompt _jquery

Source: Internet
Author: User
A good procedure is a program that a lazy person likes. A good programmer is a lazy programmer. Yesterday studied jquery imitate Baidu, Google search automatically supplemented search results prompts, feel the effect is OK. To share with you. The required jquery plugin. Please look at the code:
Copy Code code as follows:

<script type= "Text/javascript" >
$ (). Ready (function () {

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

function Auto (data) {
$ ("#keyWord"). Val (Data.name);
}

$ ("#keyWord"). AutoComplete (obj, {//obj is a data object array JSON
minchars:0,//represents the smallest character that is filled in before automatic activation is completed
Max:5,//representing the number of entries in the list
Autofill:true,//indicates automatic padding
Mustmatch:false,//means must match the entry, the text box input, must be the data parameter, if does not match, the text box is emptied
Matchcontains:true,//representation contains matches, equivalent to fuzzy matching
SCROLLHEIGHT:200,//Indicates the height of the list display, 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 Code code as follows:

<div>
<table >
<tr><td> Name: <input type= "text" id= "KeyWord"/></td></tr>
</table> </div>

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.