Why Firefox says that window.event is undefined? (call function with added event listener)

try getting the event using the parameter passed (named e in this case). i tested this and both window.event and the e is supported in chrome.

try checking for both, whichever exists

var ex = {
  exampl: function(e){

    console.log(window.event);
    console.log(e);  

    //check if we have "e" or "window.event" and use them as "evt"
    var evt = e || window.event    

  }
}

Leave a Comment