Hide Clear All Button

Good Morning,
How do I hide my Clear all button, when no search filtered is selected? Right now it just sits on my page. I know this is probably easy to do, but I can not figure it out.
I actually need to hide it and when a filtered is selected then show it.

Thanks for your help

export function clearallbutton_click(event) {
$w("#vendordropdown").value = "Select a Vendor Category:"; 
$w("#cityandstatedropdown").value = "Select a City & State:"; 
$w("#CityStatetext").hide();
$w("#Categorytext").hide();
}

Hello

so here what you should do

  1. make it hidden on load. (properties panel → hidden on load)

  2. When add filter is clicked show it. ( $w(‘#clearallbutton’).show() )

  3. on clear button click hide it.

export function clearallbutton_click(event) {
$w("#vendordropdown").value = "Select a Vendor Category:"; 
$w("#cityandstatedropdown").value = "Select a City & State:"; 
$w("#CityStatetext").hide();
$w("#Categorytext").hide();

$w('#clearallbutton').hide()
 
}

Good Luck
Massa

Massa,
That worked prefect… Thank you
How do I get my total number of results to refresh back to the total number of 23? Once I click the clear all button everything refresh but the total results. Did I miss something?

export function clearallbutton_click(event) {
$w("#vendordropdown").value = "Select a Vendor Category:"; 
$w("#cityandstatedropdown").value = "Select a City & State:"; 
$w("#CityStatetext").hide();
$w("#Categorytext").hide();
$w('#clearallbutton').hide();
$w("#dataset2").setFilter(wixData.filter())

}    

Please excuse my text box I have to fix them so they will fit correctly .

what you can do is add the following line to the click function

$w('#number of result element').text= "23 results"

Best
Massa

Thank you! it worked prefect.

I have issues with the clear button in using this code. It resets the dropdown buttons to original settings, but further searches do not function