Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the monitorEvents() equivalent for FireFox?

Google Chrome has a feature where you can run monitorEvents(document) and every event you fired will be logged in the console.

How can I get similar functionality in FireFox?

I came across this very outdated answer, but Firebug doesn't even exist anymore: Using Firefox, how can I monitor all JavaScript events that are fired?

like image 546
Eduardo06sp Avatar asked Jun 03 '18 13:06

Eduardo06sp


1 Answers

You can try this

function monitorEvents(element) {
  var log = function(e) { console.log(e);};
  var events = [];

  for(var i in element) {
    if(i.startsWith("on")) events.push(i.substr(2));
  }
  events.forEach(function(eventName) {
    element.addEventListener(eventName, log);
  });
}

Source --- https://paul.kinlan.me/monitoring-all-events-on-an-element/

Or if you want to monitor events on a specific DOM element(s) you can try this --- Examine Event Listeners on MDN

like image 54
Pawan Singh Avatar answered Oct 12 '22 01:10

Pawan Singh