awesomplete icon indicating copy to clipboard operation
awesomplete copied to clipboard

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

Open kyhos opened this issue 4 years ago • 1 comments

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>

kyhos avatar Jul 16 '21 19:07 kyhos

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

robsonsobral avatar Mar 25 '22 14:03 robsonsobral