# uiBuilder Question on eventListeners

**URL:** <https://discourse.nodered.org/t/uibuilder-question-on-eventlisteners/101067>\
**Category:** General\
**Tags:** uibuilder\
**Created:** [17 May 2026 16:20 UTC](https://discourse.nodered.org/t/uibuilder-question-on-eventlisteners/101067 "2026-05-17T16:20:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [17 May 2026 16:20 UTC](https://discourse.nodered.org/t/uibuilder-question-on-eventlisteners/101067/1 "2026-05-17T16:20:22Z")

</div>

So, not a specific Node-RED but relevant to uiBuilder

Most addEventListener examples use an anonymous handler (i.e. (event) =\> {}) but of course this makes it very difficult to remove (I tried abort() but couldn't get it to work) so I have been using handler functions which increases the code.

So the question is - how does uiBuilder handle removing eventListeners, do I even need to worry about removing them?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 May 2026 16:36 UTC](https://discourse.nodered.org/t/uibuilder-question-on-eventlisteners/101067/2 "2026-05-17T16:36:32Z")

</div>

> [@Buckskin](#):
>
> So, not a specific Node-RED but relevant to uiBuilder

Well, UIBUILDER _is_ only for Node-RED so perfectly valid in the forum. 🙂

> [@Buckskin](#):
>
> So the question is - how does uiBuilder handle removing eventListeners, do I even need to worry about removing them?

Great question.

I think the thing to remember is the context. In the browser context, the page itself is fully reset if you reload so no need to cancel event handlers if they are global to the page and not dynamically removable.

The uibuilder client itself will unload its event handlers if there is a chance it might need to reset.

So the short answer is - if you might want to dynamically remove/re-add an element and you are adding an event handler to it, then yes, you should use a pre-defined function for the handler and should remove it appropriately.

But if you aren't ever removing elements dynamically from your page, you don't need to worry about it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 August 2026 16:37 UTC](https://discourse.nodered.org/t/uibuilder-question-on-eventlisteners/101067/3 "2026-08-15T16:37:27Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
