Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add 2 or more email autocomplete in same page? #17240

Open
kyhos opened this issue Jul 16, 2021 · 1 comment
Open

How to add 2 or more email autocomplete in same page? #17240

kyhos opened this issue Jul 16, 2021 · 1 comment

Comments

@kyhos
Copy link

kyhos commented Jul 16, 2021

This code show 2 autocomplete in same (first) field.
Any alternative?
Thank you

    <input type="email" class="form-control" name="email" id="email1" required="required">
    <script type='text/javascript'>
        var input = document.getElementById("email1");
        var awesomplete = new Awesomplete('input[type=email]',{list:["gmail.com","hotmail.com","outlook.com"],data:function(text,input){return input.slice(0,input.indexOf("@"))+"@"+text;},filter:Awesomplete.FILTER_STARTSWITH});
    </script>
 <input type="email" class="form-control" name="email" id="email2" required="required">
    <script type='text/javascript'>
        var input = document.getElementById("email2");
        var awesomplete = new Awesomplete('input[type=email]',{list:["gmail.com","hotmail.com","outlook.com"],data:function(text,input){return input.slice(0,input.indexOf("@"))+"@"+text;},filter:Awesomplete.FILTER_STARTSWITH});
    </script>
@robsonsobral
Copy link

Shouldn't you store the elements on different variables and use these variables as parameters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants