There is input - it is necessary to perform. A person begins to enter data on $('input').live('keyup',function(){})
into this field $('input').live('keyup',function(){})
, if he stopped for 1 second or more, the function should be executed ... the function should not start be executed, if a person continuously enters text. How to implement it?
|
1 answer
$('input').live('keyup', function(){ if(window.a) clearTimeout(window.a); window.a = setTimeout(function(){ //... }, 1000); });
You can also clear the function execution by clearTimeout(window.a)
.
- 2only the method is not .live () , but .on () . - Deonis
|