Not an expert by an stretch here but I’ve had success doing what you are describing with something similar to the below.
export function yourBUTTONnameHERE ( event ) {
console . log ( “Your Button Pressed” )
if ( $w ( “#itemYOUWANTTOHIDE” ). isVisible ) {
$w ( “#itemYOUWANTOHIDE” ). collapse (); //collapses item
$w ( “#itemYOUWANTOHIDE” ). hide (); //hides item
$w ( “#yourBUTTONnameHERE” ). label = “SHOW” ; //changes label of button back to show
} else {
if ( $w ( “#itemYOUWANTTOHIDE” ). hidden ) {
$w ( “#itemYOUWANTOHIDE” ). expand (); //expands item
$w ( “#itemYOUWANTOHIDE” ). show (); //shows item
$w ( “#yourBUTTONnameHERE” ). label = “HIDE” ; //changes label of button back to hide
}
}
}