JSFiddle - React, Tailwind, and code Playground
HTML
<input>
<textarea></textarea>
JavaScript
$.fn.bindDelay = function( eventType, eventData, handler, timer ) {
if ( $.isFunction(eventData) ) {
timer = handler;
handler = eventData;
}
timer = (typeof timer === "number") ? timer : 300;
var timeouts;
$(this).bind(eventType, function(event) {
var that = this;
clearTimeout(timeouts);
timeouts = setTimeout(function() {
handler.call(that, event);
}, timer);
});
};
$("input").bindDelay('keyup', function() {
$("textarea").text( $(this).val() );
}, 2000);