keyup event with delay


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //@dependency jQuery
  2. timeout = undefined;
  3.  
  4. $("#id").keyup(function() {
  5. if(timeout != undefined) {
  6. clearTimeout(timeout);
  7. }
  8. var timeout = setTimeout(function() {
  9. timeout = undefined;
  10. //do it
  11. }, 900);
  12. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.