How to delay the .keyup() handler until the user stops typing?

I’ve got a search field. Right now it searches for every keyup. So if someone types “Windows”, it will make a search with AJAX for every keyup: “W”, “Wi”, “Win”, “Wind”, “Windo”, “Window”, “Windows”.

I want to have a delay, so it only searches when the user stops typing for 200 ms.

There is no option for this in the keyup function, and I have tried setTimeout, but it didn’t work.

How can I do that?

104 thoughts on “How to delay the .keyup() handler until the user stops typing?”

  1. 128323 332653Hello! I just wish to give an enormous thumbs up for the good information you might have proper here on this post. I can be coming once more to your weblog for much more soon. 338034

  2. 350117 80829The the next occasion I read a weblog, I genuinely hope so it doesnt disappoint me about brussels. Come on, man, Yes, it was my option to read, but I just thought youd have some thing interesting to state. All I hear can be lots of whining about something which you could fix should you werent too busy searching for attention. 614137


Leave a Comment