fn typeWatch function wait fire this each function var input this var

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$.fn.typeWatch = function(wait, fire) {
this.each(function() {
var input = this;
var timeout;
$(input).keyup(function() {
clearTimeout(timeout);
timeout = setTimeout(function() { fire(); }, wait)
});
});
return this;
}
$('input').typeWatch(200, function() {
//your actions
});