JQuery UI Implementation Email input hint instance _jquery

Source: Internet
Author: User
Effect:

Copy Code code as follows:

Using the jquery UI, JS and CSS to import:
<link rel= "stylesheet" href= ". /.. /themes/base/jquery.ui.all.css ">
<link rel= "stylesheet" href= ". /demos.css ">
<script src= ". /.. /jquery-1.7.2.js "></script>
<script src= ". /.. /ui/jquery.ui.core.js "></script>
<script src= ". /.. /ui/jquery.ui.widget.js "></script>
<script src= ". /.. /ui/jquery.ui.position.js "></script>
<script src= ". /.. /ui/jquery.ui.autocomplete.js "></script>

<script>
var emails=["163.com", "yahoo.com", "yahoo.cn", "126.com", "sina.com"];
$ (function () {
Bind an event for an input box
$ ("#email"). KeyUp (function () {
EMAILIINP ();
});
});
function Emailiinp () {
var arrs= new Array ()
inpval=$ ("#email"). Val ();
Creates a Drop-down list dynamically based on the value you enter
$.each (Emails, function (index,info) {
if (Inpval.indexof ("@") ==-1)
{
No input @
arrs[index]=inpval+ "@" +INFO;
} else {
Enter
Arrs[index]=inpval.substring (0,inpval.indexof ("@")) + "@" +INFO;
}
})
$ ("#email"). AutoComplete ({
Bind the dropdown list content
Source:arrs
});
}
</script>
And finally a text box:
<input id= "Email"/>
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.