On click event

I am having difficulties using the onClick event for my website. I have a button, I have a box. I tried using the onClick event for my button. The problem is that I have used the onClick event successfully and the box shows when I click on the button, but when I click on somewhere else on the page, the box doesn’t go away.
The code I used:
export function button23_click(event) {
$w( “#box2” ).show();
}
Is there something I forgot?

1 Like

Then wtite a onclick event for the page/location where u want the box to be hidden on click and hide the box.

I didn’t understand. I have just started coding. May you please give me the code?

I understand now! Thank you so much.

Do just like you did for the button. Make a click event on the page and inside the event hide the button.