Email Domain Name Autocomplete In JavaScript – Email Genie

Category: Form , Javascript | March 29, 2021
Author: smnarnold
Views Total: 107 views
Official Page: Go to website
Last Update: March 29, 2021
License: MIT

Preview:

Email Domain Name Autocomplete In JavaScript – Email Genie

Description:

Email Genie is a tiny email domain name autocomplete library that shows a domain suggestion list while typing an email username in an email input.

How to use it:

1. Install and import the Email Genie.

# NPM
$ npm i email-genie
import EmailGenie from 'email-genie';

2. Or insert the email-genie.min.js into the document.

<script src=”/dist/email-genie.min.js”></script>

3. Create an email input on the page.

<input type="email" class="email" />

4. Initialize the Email Genie and we’re done.

var field = new EmailGenie('.email');

5. Append more domain names to the domain list.

var field = new EmailGenie('.email',{
    domains: ['gmail.com', 'outlook.com', 'hotmail.com', 'msn.com', 'live.com', 'googlemail.com', 'yahoo.com', 'me.com', 'icloud.com']
});

6. Determine whether to override the built-in domain list.

var field = new EmailGenie('.email',{
    domains: ['gmail.com', 'outlook.com', 'hotmail.com', 'msn.com', 'live.com', 'googlemail.com', 'yahoo.com', 'me.com', 'icloud.com'],
    overrideDomains: true,
    insert: 'afterend' // 'beforebegin', 'afterend', 'documentend'
});

You Might Be Interested In:


Leave a Reply