Quantcast
Channel: HTML – Interface Developer Blog
Viewing all articles
Browse latest Browse all 3

Delay JavaScript input events for multiple interactions

$
0
0

If you have a feature that filters data, or even hits a live API, after the user inputs some text you may want to throttle the event, ideally adding a delay so it only triggers the event once. I guess in layman’s terms we are making the event wait for the user to finish typing.

It can be very easily fixed by assigning a setTimeout method to a variable and then clearing the setTimeout if the event fires again, that way it will continually overwrite itself until the user stops. Here’s a quick fiddle to demonstrate the technique.

The post Delay JavaScript input events for multiple interactions appeared first on Interface Developer Blog.


Viewing all articles
Browse latest Browse all 3

Trending Articles