# How can I disable the draggable option of an element using JavaScript?

**URL:** <https://forum.bricksbuilder.io/t/how-can-i-disable-the-draggable-option-of-an-element-using-javascript/31738>\
**Category:** How To\
**Created:** [April 14, 2025, 2:36am UTC](https://forum.bricksbuilder.io/t/how-can-i-disable-the-draggable-option-of-an-element-using-javascript/31738 "2025-04-14T02:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emuplugins](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/emuplugins/32/26132_2.png) [@emuplugins](https://forum.bricksbuilder.io/u/emuplugins)\
**Post date:** [April 14, 2025, 2:36am UTC](https://forum.bricksbuilder.io/t/how-can-i-disable-the-draggable-option-of-an-element-using-javascript/31738/1 "2025-04-14T02:36:03Z")

</div>

My plugin has a lightbox that closes when you click outside of it. However, when I click on the lightbox, the draggable option of the editor widgets gets activated and seems to stop the propagation of other events. I think this is why the event listeners for the lightbox element don’t work in the builder, only on the frontend.

How can I disable the draggable option of an element via JavaScript? With this functionality, I was able to disable the draggable option only when the lightbox is active. I tried using CSS pseudo-selectors like `:has(.epg-lightbox[style*="display: flex"])`, but it only works on the frontend as well. I also tried preventing the propagation of events from all elements, but it didn’t work. It seems that the builder’s JavaScript takes priority over any solution I’ve tried.

Whenever I click on the lightbox, it stays like this, as if the lightbox has `position: absolute`, but it is sticky.

I couldn’t upload the first image, but it looks something like this.

 ![image](https://forum.bricksbuilder.io/uploads/default/original/3X/f/f/ff955187b63e08ddaeef5e545e8523913d3deb6d.jpeg)

Also, any function that triggers a click inside the lightbox is ignored 😄

---

<div class="post-metadata">

**Author:** ![emuplugins](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/emuplugins/32/26132_2.png) [@emuplugins](https://forum.bricksbuilder.io/u/emuplugins)\
**Post date:** [April 14, 2025, 2:38am UTC](https://forum.bricksbuilder.io/t/how-can-i-disable-the-draggable-option-of-an-element-using-javascript/31738/2 "2025-04-14T02:38:59Z")

</div>

before any click

 ![image](https://forum.bricksbuilder.io/uploads/default/original/3X/f/b/fbe1a0f7347fbbee217b43c427ed2ebc24f03e03.jpeg)
