JSFiddle - React, Tailwind, and code Playground

by werty1001

HTML

<input type="text" id="myinput">

JavaScript

$( document ).ready(function() {

	var input = $( '#myinput' ), timeOut;

		input.on( 'keyup', function () {

			clearTimeout( timeOut );

			timeOut = setTimeout( myfunc, 2000, $( this ).val() );

		});

		input.on( 'keydown', function () {

			clearTimeout( timeOut );

		});

		function myfunc( value ) {

			alert( value );

		}

});