How can I reset the Swiftype search autocomplete dropdown when a user clicks away?


#1

When a user clicks away from the site search box on my page I want the search suggestions in the autocomplete dropdown to clear out. Can I do this with Swiftype’s JavaScript autocomplete widget?

You can definitely have the search suggestion dropdown empty out once a user clicks elsewhere on the page. Here is an example of how to do so with jQuery:

$('.swiftype-widget .autocomplete ul').empty()