-2
I’m having trouble inserting the values of an array into an input with JS.
What I’m looking for is, make it look like there’s a person writing and it’s not a value that’s been entered quickly and complete.
(Function() {
let campo = document.querySelector(".form-control");
let posicaoatual = 0;
setInterval(
() => {
posicaoatual = posicaoatual + 1;
if ( arraynomes[ posicaoatual ] != null )
{
campo.value = arraynomes[ posicaoatual ];
console.log(campo.value);
}
else
{
console.log( 'Acabou o array, estou atoa desde:' + new Date());
}
}, 5000 );
This is the array.
const arraynomes = ['Alexandre', Dank, 'Rich, 'Guilherme', 'Jessica', 'Ligia', 'marina' 'peter', 'Renata'];
Remembering that the value of the input cannot only be an inserted value but simulate a person by typing.
Any questions in the code just ask. Thank you!
Pedro, include your code as text, not as an image, because if someone is going to test your code they will have the unnecessary work of typing everything that is in the image.
– Andre
Thanks for the tip!
– Pedro Henrique