Example
let t;
input.addEventListener('input', () => {
clearTimeout(t);
t = setTimeout(search, 200);
});
Related
Updated 2026-11-26
DOM →
Wait until input stops for a moment before acting, instead of reacting to every keystroke.
let t;
input.addEventListener('input', () => {
clearTimeout(t);
t = setTimeout(search, 200);
});