How to detect the text in a searchbox for geographical places?

I have a searchbox for geographical places and I put an “X” icon to reset the content on the right of it. I want this “X” to be visible when the searchbox test is not empty but I don’t see a way to do it.

There is only the “searchbox’s value” that is set when we click enter, not when the typed text is changed so it’s not enough.

Thank you,

Hey :waving_hand:

You can put two conditions (and combine them with a and/or depending on your use case) for your “X” visibility :

  • When searchbox value is not empty → When user pressed enter and already selected a value
  • And/Or when searchbox is focused → When the typed text is changed.

Hoping this helps ! :+1:

There is no “typed text” option for search box with geographical places, is there something I am missing ? @ThibautC

Sorry, didn’t see you were talking about geographic adresses, but focus part still works with geographic adress. See my screenshot below

Your “x” icon will appear when someone is typing an adress in this case.

I am looking to show it when the typed text is not empty, not when it’s focused. I will explore other solutions, Thanks again @ThibautC

This topic was automatically closed after 70 days. New replies are no longer allowed.