Keypress timer for Prototype

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

Copy this code and paste it in your HTML
  1. $('my_text_field').observe('keyup',function(event){
  2. var element = this;
  3. if (this.timer) clearTimeout(element.timer);
  4. this.timer = setTimeout(function(){
  5. alert("Nothing Pressed for 1000ms")
  6. },1000);
  7. return true;
  8. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.