HTML
<div class="seachbox"> <input type="text" name="seach-text" id="seach-text"> </div>
Javascript:
function delay(callback, ms) { var timer = 0; return function () { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } $('#seach-text').keyup( delay(function (e) { console.log('Time elapsed!', this.value); }, 500) );