JSFiddle - React, Tailwind, and code Playground
HTML
<input id="in" type="text"/>
<div id="out"></div>
JavaScript
//setup before functions
var typingTimer; //timer identifier
var doneTypingInterval = 1000; //time in ms, 5 second for example
//on keyup, start the countdown
$('#in').keyup(function(){
clearTimeout(typingTimer);
if ($('#in').val) {
typingTimer = setTimeout(function(){
//do stuff here e.g ajax call etc....
var v = $("#in").val();
$("#out").html(v);
}, doneTypingInterval);
}
});