jquery Search Plugin Auntocomplete

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Search Plugins </title>
<link href= "Http://www.imooc.com/data/jquery.autocomplete.css" rel= "stylesheet" type= "Text/css"/>
<link href= "Style.css" rel= "stylesheet" type= "Text/css"/>
<script type= "Text/javascript" src= "Http://www.imooc.com/data/jquery-1.8.2.min.js" ></script>
<script src= "Http://www.imooc.com/data/jquery.autocomplete.js" type= "Text/javascript" ></script>

<body>
<div id= "Divtest" >
<div class= "title" >
<span class= "FL" > Search plugin </span>
</div>
<div class= "Content" >
<span class= "fl" >username</span><br/>
<input id= "Txtsearch" name= "Txtsearch" type= "text"/>
<div class= "Tip" >
</div>
</div>
</div>

<script type= "Text/javascript" >
$ (function () {
var arrusername = ["Harry", "Liu Ming", "Li Xiaoxi", "Liu Ming", "Liyuan", "Zhangxiao", "Wang Xiaoming"];
$ ("#txtSearch"). AutoComplete (arrusername,{
minchars:0,//display all prompt data when double-clicking a blank text box
Formatitem:function (data, I, total) {
Return "<I>" + data[0] + "</I>"; Change the format of the matching data display
},
Formatmatch:function (data, I, total) {
return data[0];
},
Formatresult:function (data) {
return data[0];
}
}). result (Searchcallback);
function Searchcallback (event, data, formatted) {
$ (". Tip"). Show (). HTML ("Your choice is:" + (!data?). "EMPTY": formatted));
}
});
</script>
</body>

jquery Search Plugin Auntocomplete

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.