1
I’m using the materialize framework. According to the documentation, I can use "autocomplete" in the form tag according to the link Materialize Form. My doubt, is the following I want to create a javascript for extensions autocomplete, example: @gmail.com, @outlook.com, @Hotmail.com. When the user enters "@" this list appears. Below my code
<div class="row">
<div class="input-field col l6">
<i class="material-icons prefix">email</i>
<input type="email" id="email" class="validate" autocomplete="off">
<label data-error="E-mail invalido!" data-success="E-mail valido!" for="nome">E-mail</label>
</div>
</div>
Javascript:
<script>
//Função para autocomplete do email
$(document).ready(function(){
//pegando o id do formulario
$('#email').autocomplete({
//Aqui declaro algumas possiveis extensoes de email para autocompletar
data: {
"@hotmail.com": null, /
"@gmail.com": null,
"@outlook.com": "img/outlook.jpg",
},
limit: 20, // The max amount of results that can be shown at once. Default: Infinity.
onAutocomplete: function(val) {
// Função quando é valido ou seja completado!
//alert("ok");
},
minLength: 1, // The minimum length of the input for the autocomplete to start. Default: 1.
});
});
</script>
And what’s going wrong in your code?
– Renato Diniz