# Reset variable when user click anywhere on page except on some elements

**URL:** <https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702>\
**Category:** How do I?\
**Created:** [August 18, 2025, 4:35pm UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702 "2025-08-18T16:35:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zoran.Velinov](https://avatars.discourse-cdn.com/v4/letter/z/f1d935/32.png) [@Zoran.Velinov](https://community.weweb.io/u/Zoran.Velinov)\
**Post date:** [August 18, 2025, 4:35pm UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/1 "2025-08-18T16:35:56Z")

</div>

### I have elements on page on which when i click they set their own boolean variable.

Now i want when i click on any other part of the page this variables to be reseted.

Dont say to put invisible container over and make workflow. No matter that it work, i cant do this.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![sam1](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/sam1/32/6724_2.png) [@sam1](https://community.weweb.io/u/sam1)\
**Post date:** [August 18, 2025, 8:18pm UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/2 "2025-08-18T20:18:19Z")

</div>

you could try put a workflow on whatever your background element is changing the bool to false and then have stop click propagation on the elements you don’t want it to change.

---

<div class="post-metadata">

**Author:** ![Zoran.Velinov](https://avatars.discourse-cdn.com/v4/letter/z/f1d935/32.png) [@Zoran.Velinov](https://community.weweb.io/u/Zoran.Velinov)\
**Post date:** [August 19, 2025, 9:49am UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/3 "2025-08-19T09:49:46Z")

</div>

It cant be done like this. I will prepare some pictures to show you

---

<div class="post-metadata">

**Author:** ![Zoran.Velinov](https://avatars.discourse-cdn.com/v4/letter/z/f1d935/32.png) [@Zoran.Velinov](https://community.weweb.io/u/Zoran.Velinov)\
**Post date:** [August 19, 2025, 10:38am UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/4 "2025-08-19T10:38:51Z")

</div>

1. As you can see here in logs, when i click on user icon(top righ corner) workflow for user icon change variable to True. But because i have workflow on Main Container to reset same variable it reset it immediately to false.

![Reset1](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b54f05f51aea05757acfbe49b2162fc8ec8c3d1d.gif)

1. Here you can see that z-axis for user icon is 51(so its above) and z-axis for Main Container is 50(so its bellow) but still it react on user icon like i have click on container.  
 ![Reset2](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/841f1c436277e716dc9d0caa4daaeba1ccac8b62.gif)

I want when i click on User Icon, variable to be set to True(i have workflow for this) but when i click on any other place on page this variable to be Reseted.

---

<div class="post-metadata">

**Author:** ![sam1](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/sam1/32/6724_2.png) [@sam1](https://community.weweb.io/u/sam1)\
**Post date:** [August 19, 2025, 10:10pm UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/5 "2025-08-19T22:10:21Z")

</div>

it sure can be done haha what you have missed is the stop click propagation action the docs explain it well.

> **[Stop click propagation | Documentation](https://docs.weweb.io/workflows/actions/stop-click-propagation.html#the-solution)**
>
> Learn how to prevent event bubbling in WeWeb using the Stop propagation action to control click events and avoid unintended interactions.

---

<div class="post-metadata">

**Author:** ![Zoran.Velinov](https://avatars.discourse-cdn.com/v4/letter/z/f1d935/32.png) [@Zoran.Velinov](https://community.weweb.io/u/Zoran.Velinov)\
**Post date:** [August 20, 2025, 10:17am UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/6 "2025-08-20T10:17:27Z")

</div>

Thank you man this was helpfull 🙂 But now have other problem. When i set variable to True and its open container with elements in it, after i click on some element it close it(reset variable). Look bottom for example. When i click on input element to write something its close it.

![Reset3](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e0b6698cb13303f829bc47c85763f543e19dedfd.gif)

---

<div class="post-metadata">

**Author:** ![Zoran.Velinov](https://avatars.discourse-cdn.com/v4/letter/z/f1d935/32.png) [@Zoran.Velinov](https://community.weweb.io/u/Zoran.Velinov)\
**Post date:** [August 21, 2025, 8:16am UTC](https://community.weweb.io/t/reset-variable-when-user-click-anywhere-on-page-except-on-some-elements/19702/7 "2025-08-21T08:16:22Z")

</div>

Anybody that can help?
