Skip to content

Instantly share code, notes, and snippets.

@leandroadacosta
Created November 8, 2012 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandroadacosta/4039884 to your computer and use it in GitHub Desktop.
Save leandroadacosta/4039884 to your computer and use it in GitHub Desktop.
keyup-timeout.js
var keyupTimeout = null;
$('.search-field').keyup(function() {
if (!keyupTimeout && this.value.length > 1) {
keyupTimeout = setTimeout(function() {
$(this).parent('form').submit();
keyupTimeout = null;
}, 700);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment