Is there a way to delete a event listener that is in the DOM of a page using javascript?

I am wondering if there is a way of deleting a Event Listener using Javascript and I can’t use removeEventListener() because I am not the one that made the Event Listener, it’s already in the code of the website when I open it and I need it to be automatically removed so that the popup message does not prompt (It’s very annoying when I have to delete 1000 things and a message comes up every time say "Do you want to delete these assets?").

My process that I take is:

  1. I open the page (Already has an Event listener)
  2. Proceed to delete assets (From a form)
  3. Then when I click the submit on the page it has an Event listener attached to it (The one I need to get rid of when I open the page)
  4. Then the Event Listener prompts and return confirm("Do you want to delete these assets?") (Very annoying)

Any idea on how I would delete this even listener that’s on the page and is not opened by me?

Here is a picture of what the event listener looks like:

enter image description here

If you do help I thank in advance!

33 thoughts on “Is there a way to delete a event listener that is in the DOM of a page using javascript?”

Leave a Comment