Skip to content

Instantly share code, notes, and snippets.

@devudit
Last active December 3, 2017 18:25
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 devudit/122a280967521a25b8bdbd875426593c to your computer and use it in GitHub Desktop.
Save devudit/122a280967521a25b8bdbd875426593c to your computer and use it in GitHub Desktop.
Run a javascript function after user has stopped typing
<input type='text' id='text'>
var timer = null;
$('#text').keydown(function(){
clearTimeout(timer);
timer = setTimeout(doStuff, 1000)
});
function doStuff() {
alert('do stuff');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment