JSFiddle - React, Tailwind, and code Playground

This senses keystokes on the inputbox, wait till there has been a pause of 750ms then calls function.

by Ben Clayton

HTML

<input type=text id="mysearch" /><br/><br/>Type in box, when you pause it will show you what you have typed.

JavaScript

(function ($) {
    $.fn.infxkeypause = function (delayfunc) {
        var base = this;
        var timerhandle;
        var _delayfunc= delayfunc;
        $(base).on('keyup', function () {
            if (timerhandle) clearTimeout(timerhandle);
            //setup new one
            timerhandle = setTimeout(function () {
                if(_delayfunc) _delayfunc(base);
            }, 750);
        });
      return this;
    };

}(jQuery));

$('#mysearch').infxkeypause(function (inp){
    alert("You typed '"+inp.val()+"'");
});