title: Using javascript / jQuery event handler in Firefox
body: <p>I have a jQuery function that submits a form via menu navigation functions:</p>
  
  <pre><code>$(function () {
      $('#sidebarmenu1 a').on('click', function () {
          var url = $(this).attr('href');
          $('#myform').attr('action', url);
          $("#myform").submit();
          if (event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; }
      })
  });
  </code></pre>
  
  <p>This section:</p>
  
  <pre><code>if (event.preventDefault) 
  { event.preventDefault(); } 
  else 
  { event.returnValue = false; }
  </code></pre>
  
  <p>Prevents the default action of the sidebar button (I think - still new to this) i.e. to simply navigate to a page.</p>
  
  <p>It is written in this way to keey IE happy, because preventDefault isn't defined for IE (might be using incorrect terminology there, but IE doesn't like preventDefault.)</p>
  
  <p>However now this throws up an error in firefox, because (as I read on other stack questions) event is not globally defined for FF! I get the following error:</p>
  
  <blockquote>
    <p>ReferenceError: event is not defined</p>
  </blockquote>
  
  <p>Now acorrding to this stack question:
  <a href="https://stackoverflow.com/questions/2974601/event-is-not-defined-in-firefox-but-ok-in-chrome-and-ie">event is not defined in FireFox, but ok in Chrome and IE</a></p>
  
  <blockquote>
    <p>In IE and Chrome, event is resolving to window.event. Firefox doesn't have this property and instead provides an event to an event handler function by passing it as a parameter. jQuery abstracts this difference for you by providing an event object parameter in all browsers.</p>
  </blockquote>
  
  <p>But I thought I was using jQuery here and am still getting the issue.</p>
  
  <p>Sorry if I'm making basic mistakes, self teaching myself js and jQ. Any help much appreciated, thanks!</p>