0

screenshot form of inspect element on firefox

This Image is from a live site that has a mouse enter and leave event. I've to remove its mouseLeave event to test some other things.

temp3.removeEventListener("mouseleave", this, true);

temp3 is a variable provided by firefox of that element (use in console). This doesn't remove its mouseLeave event

Note: site is built on React Js

Edit: Yes, the question is duplicate but I don't think the previous one had solved the issue, that's why I'm asking again.

anjit pariyar
  • 51
  • 2
  • 7
  • You can only remove an event listener if you still have the original callback. – evolutionxbox Feb 28 '22 at 12:18
  • 1
    You can only use `removeEventListener` is you still have a reference to the handler function. Without that, you can clone the element and replace it with its clone (this will remove *all* event handlers though) –  Feb 28 '22 at 12:18
  • Yes but I need its `mouseEnter` event too. that's why I couldn't clone it. `removeEventListener` isn't working, maybe it's a virtual DOM. I don't know – anjit pariyar Feb 28 '22 at 12:22
  • @evolutionxbox sorry, It doesn't seem to work either. maybe we can't remove events without their original callback. hey, you should try that on this StackOverflow. pick any random event and try to remove it. – anjit pariyar Feb 28 '22 at 14:03

1 Answers1

1
  1. Open chrome

  2. Inspect the element

  3. Click on the 'Event Listeners' tab

enter image description here

Simon Leroux
  • 447
  • 2
  • 5