D
D
danyfir2020-04-22 22:29:57
JavaScript
danyfir, 2020-04-22 22:29:57

How to change placeholder after n seconds?

There is an input with id "vvod" It is
necessary that every 3 seconds the placeholder changes from "Please enter" to "last name first name"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-04-22
@danyfir

const placeholders = [ 'hello, world!!', 'fuck the world', 'fuck everything' ];
let index = -1;

setInterval(function() {
  index = (index + 1) % placeholders.length;
  document.querySelector('input').placeholder = placeholders[index];
}, 1000);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question