Skip to content

Instantly share code, notes, and snippets.

@ericchen
Created April 29, 2011 02:21
Show Gist options
  • Save ericchen/947727 to your computer and use it in GitHub Desktop.
Save ericchen/947727 to your computer and use it in GitHub Desktop.
Jquery keyup delay
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
$('input').keyup(function() {
delay(function(){
alert('Time elapsed!');
}, 1000 );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment