JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="text" name="test" id="test" />
</form>
JavaScript
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
$('input').on('keyup', function() {
delay(function() {
alert('1 second delay');
}, 1000);
});