title: jquery Firefox doesn't fire window.onload
body: <p>the following code works fine on chrome but in fire fox. it only works once and then if I refresh the page it won't work again.
  any idea on how to fix that</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.onload = new function() {
        $(document).on('click', 'div', function() {
              if ($(".ystq_buddy").hasClass("ystq_swipe-right") || $( 
                    ".ystq_buddy" ).hasClass( "ystq_swipe-left")) {
  
                     $(document.forms['f1']).submit();
              }
        }); 
  };
  &lt;/script&gt;
  </code></pre>