# How to check if popup is already opened

**URL:** <https://community.weweb.io/t/how-to-check-if-popup-is-already-opened/20956>\
**Category:** How do I?\
**Created:** [March 29, 2026, 7:25pm UTC](https://community.weweb.io/t/how-to-check-if-popup-is-already-opened/20956 "2026-03-29T19:25:16Z")\
**Posts on this page:** 3\
**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:** [March 29, 2026, 7:25pm UTC](https://community.weweb.io/t/how-to-check-if-popup-is-already-opened/20956/1 "2026-03-29T19:25:16Z")

</div>

Hello,

I am opening popup on enter key event on input field.

Problem is that when popup will be opened and user continue to press enter its always opens and opens new popup windows one over another.

Is there setting that allow only 1 instance to be opened?

In popup settings i see only Prevent scrolling the page when dialog is open, but i dont see preventing more than one instance.

I can do it with boolean variable for every popup, but i have allot of popups and some are called from multiple places so possibility to miss something is huge.

One boolean variable that will be for all popups is not good solution because there is some popups that opens after click in already opened popup, so if first make variable false, next will not popup.

If i make it with number variable and change it with separate number for every popup will also make problem because if popup number 1 is opened and from this popup you open popup 2, variable will be changed to 2, so after that you will be able to open new popup instance from popup number 1.

Best will be if there is some setting for this for not opening more than 1 instance of popup that is already opened. But as i see there is no option for this.

Anybody help?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [March 30, 2026, 10:16am UTC](https://community.weweb.io/t/how-to-check-if-popup-is-already-opened/20956/2 "2026-03-30T10:16:49Z")

</div>

Hey Zoran, great question!

I think this could be a nice approach for your use case: [https://www.tella.tv/video/limit-popup-instance-366w](https://www.tella.tv/video/limit-popup-instance-366w)

Can you take a look and let me know if that works for 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:** [March 30, 2026, 11:57am UTC](https://community.weweb.io/t/how-to-check-if-popup-is-already-opened/20956/3 "2026-03-30T11:57:32Z")

</div>

Hello Joyce,

Thank you for you answer. And for making example and record the video.

Your package of boolean and name(or popup number) is great. I believed that still can be problem in this situation:

If i have oepened Popup Number 1 and from this popup i am opening another different Popup Number 2, when i will close Popup Number 2 it will reset openPopup variable, which mean after that you will be able again to open Popup Number 1 while he is already opened, just because variable openPopup was reseted from Popup Number 2.

But good news are that i just make some test with 2 popups and when you start interacting with opened Popup 1(click on Popup 1 button for opening Popup 2 or whatever), you are not interacting with page in background anymore and with this presing Enter will not open new Popup 1 instance. Which is good.

Before you click on opened popup you are still interacting with page in backgroun but now this will be solved with varaible till user click somewhere on popup, after that is not matter anymore.

Thank you very much

I also hope that for this problem will be also some solution because it is much more important for me and i believe for others in the future.

> [@Unload elements from DOM on Infinite scrolling](https://community.weweb.io/t/unload-elements-from-dom-on-infinite-scrolling/20955):
>
> Hello, I have watch the video for infinite scrolling: [[Infinite scrolling in WeWeb] ](https://www.youtube.com/watch?v=f7lM-yqWJqY) Everything is clear except one thing. Let say we have some cards like this on page: Now when user go to the bottom of the page it will load more. Let say 12 more. So if user continue to scroll at some point it will load too much, for example more than 200 and it will become heavy for the browser. So how to remove passed cards from DOM every time i load …
