0

Given the following code:

openUserProfile: function(){
    event.preventDefault();

    // Rest of function
}

In Firefox, it throws ReferenceError: event is not defined as expected, because event is not passed in as a parameter. However in Chrome and Safari, event is defined and thus the code above runs fine.

Is there an explanation for this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Cubed Eye
  • 5,581
  • 4
  • 48
  • 64

1 Answers1

3

Go through this thread; window.event is not defined in FF

Javascript Error in FireFox Not in IE and Chrome

Instead try this:-

openUserProfile: function(e){
    e.preventDefault();

    // Rest of function
}
Community
  • 1
  • 1
PSL
  • 123,204
  • 21
  • 253
  • 243