Clear search text when exiting a search box

Is there a way to clear my search box when my users close the search. Right now even after they select X, the text still stays.

I looked at clearRefinements | InstantSearch.js | API parameters | API Reference | Algolia Documentation, but this seems to apply when users actively clear the text. Not when they close the search.

I am using instant search.

You need to use the the excluded attributes property and set it to blank.

In case you use any specific instantseach plugin you’ll find a variation for it in clear refinements widget.

This isn’t what I’m looking for. This just clears my refinement list.

I want to clear the search text when they click the X to close the search.

Is the search icon a custom implementation or uses the showReset option?

Added .blur to my search element. searchInput.blur();

hey @tatiana.p is adding .blur() solves the problem? I think it will only remove the focus and wont clear the search input.
Algolia’s search box uses input=search <input type="search"> - HTML: HyperText Markup Language | MDN which comes with its X icon that clears the input field automatically.

We have a custom setup so adding blur cleared it for us.

Okay. Great. Happy to hear that.