This code will execute a function after the user has stopped typing for a time of 1000ms. Hence the function will not be called on each keyup event. Great!!! jQuery(function(){ 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 ); }); });
JavaScript
keyup function with delay
This code will execute a function after the user has stopped typing for a time of 1000ms. Hence the function will not be called on each keyup event. Grea
· 5 min read
Related posts
JavaScript
Toggle checkboxes with jQuery and Prototype JS
Sometimes you work with forms having a long list of checkboxes, in such scenarios a “Check All” or “Toggle Selection” button comes handy
JavaScript
JQuery Multi fileupload
File Upload widget with multiple file selection, drag&drop support, progress bars and preview images for jQuery. Supports cross-domain, chunked and resumabl
JavaScript
JQuery tooltip
Here is a nice jQuery tool tip. How to use: 1- Download the file 1.1- Rename the file tipsy-zip.doc to tipsy.zip 1.2- Extract the zip folder or download it from