Asp.net MVC automatically prompts a prompt box similar to Google

Source: Internet
Author: User

It is used in the mvc project. With the help of the jq function, the jq framework and related js and css are first reflected.

@ Section head {

<Link href = "@ Url. Content ("~ /Content/Site.css ")" rel = "stylesheet" type = "text/css"/>
<Script src = "@ Url. Content ("/Scripts/jquery-1.4.4.min.js ")" type = "text/javascript"> </script>
<Script src = "@ Url. Content ("/Scripts/jquery. easyui. min. js ")" type = "text/javascript"> </script>
<Script src = "@ Url. Content ("/Scripts/jquery. validate. min. js ")" type = "text/javascript"> </script>
<Script src = "@ Url. Content ("/Scripts/jquery. validate. unobtrusive. min. js ")" type = "text/javascript"> </script>
<Link href = "@ Url. Content ("/Content/jquery.autocomplete.css ")" rel = "stylesheet" type = "text/css"/>
<SCRIPT src = "@ URL. Content ("/scripts/jquery. autocomplete. js ")" type = "text/JavaScript"> </SCRIPT>

 

<SCRIPT type = "text/JavaScript">

Function findvalue (Li)
{
If (Li = NULL) return alert ("not found ");
If (!! Li. Extra)
VaR svalue = Unescape (Li. Extra [0]);

}
Function selectitem (Li)
{
Findvalue (LI );
}

$ (Document). Ready (function ()
{
$ ("# Test "). autoComplete ("/area1/en-US/sky/getnamelist1", // here I have added a region and must write the complete path if there is no region/controller/Action
{
Delay: 10,
Minchars: 1,
Matchsubset: 1,
Cachelength: 1,
Onitemselect: selectitem,
Onfindvalue: findvalue,
AutoFill: True,
Maxitemstoshow: 20
});
});
</SCRIPT>

}

Action method:

Public contentresult getnamelist1 ()
{
String name = "A \ Nb \ nc \ nd \ ne \ NF \ ng \ NH \ NJ \ n ";
Return content (name );
}

HTML:

<Input id = "test" type = "text"/>

This function is simply implemented, so it cannot be said that JQ is powerful!

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.