JSFiddle - React, Tailwind, and code Playground

by Alexis LĂłpez Espinoza

HTML

Escribe algo: <input type = "text" id = "algo" autofocus />

JavaScript

var input = document.getElementById("algo"),
    intervalo;

input.addEventListener("keyup", function(){
    clearInterval(intervalo);
    intervalo = setInterval(function(){
        alert ("Has dejado de escribir");
        clearInterval(intervalo);
    }, 4000);
}, false);