JSFiddle - React, Tailwind, and code Playground
HTML
<input id="myInput" type="text" />
JavaScript
$(document).ready(() => {
const input = document.getElementById("myInput");
input.style.position = "absolute";
input.style.top = "-100px";
input.focus(); // on DOM ready
let timeout = null;
input.addEventListener('keyup', () => {
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(() => {
if(input.value) {
alert(`I got ${input.value}`);
input.value = "";
}
input.focus();
}, 100);
});
});