Skip to content
Advertisement

Clear Input Box Every x Seconds [closed]

I’d like to know how to clear a text box every ‘x’ seconds using JavaScript (or whatever’s best) in my HTML/PHP iPad WebApp.

Any help is appreciated!

Advertisement

Answer

Vanilla javascript: clears input value every 3 seconds

setInterval(
  function() {
    document.getElementById("my-input").value = "";
  }, 3000);
<input id="my-input" type="text" />
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement