LeaVerou / awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.

Home Page:http://leaverou.github.io/awesomplete/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kyhos opened this issue · comments

commented

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>

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