title: Mozilla Firefox says Referenceerror event is not defined, no solution has worked
body: <p>I have been having troubles with my code. I have searched and found several solutions, but none of them did the trick. The problem is that mozilla firefox gives me an error: event is nod defined. Other browsers work fine. My HTML code to call the function: </p>
  
  <pre><code>var demoMap = '&lt;table class="popup" onclick="closePopup(this)"&gt;&lt;tr&gt;&lt;td&gt;';
  </code></pre>
  
  <p>And javascript</p>
  
  <pre><code>function closePopup(e) {
  
     if ( $(event.target).closest("#map").get(0) == null ) {    
          $(e).fadeOut(500, function () {
              $(e).remove();
          });
      }
  }
  </code></pre>