Last active
October 26, 2022 13:19
-
-
Save vielhuber/4ed60232d67d81752db1d79030115438 to your computer and use it in GitHub Desktop.
delay for input type change ajax autocomplete #js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var delay = (function(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout (timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); | |
$('input').keyup(function() { | |
delay(function(){ | |
alert('foo'); | |
}, 1000 ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment