Event on First Click, second event on Second

Dear All,

I have a button #button and a box #box

The #box is collapsed on load, the pushing button to expand I put into my code:

export function ButtonExpand2BCV_click(event, $w) {
$w(‘#box’).expand();
}

but how to do collapse again on the second click and expand again on the third.

Thank you for your help.
Best Regards,
Xavier

Dear All,

I found

if ( $w(“#box”).collapsed ) {
$w(“#box”).expand();
}
else {
$w(“#box”).collapse();
}

Thank you.
Best Regards,
Xavier

Perhaps my tutorial can be of service …

(Link to tutorial site: https://codequeen.wixsite.com/double-collapse )