JQuery UI implements email input prompt instance

Source: Internet
Author: User

Effect:
 
Copy codeThe Code is as follows:
When Jquery UI is used, the js and css to be imported are as follows:
<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 to the input box
$ ("# Email"). keyup (function (){
Emailiindium ();
});
});
Function emailiindium (){
Var arrs = new Array ()
InpVal = $ ("# email"). val ();
// Dynamically create a drop-down list based on the input value
$. 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 drop-down list content
Source: arrs
});
}
</Script>
Next 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.