title: How to prevent onbeforeunload from being called when clicking submit button
body: <p>How can I prevent onbeforeunload from being called when clicking the submit button? </p>
  
  <pre><code>$(document).ready(function() 
   {
    $('input:text,input:checkbox,input:radio,textarea,select').one('change', function() 
    {
     //('BODY').attr('onbeforeunload',"return 'Leaving this page will cause any unsaved data to be lost.';");
     if(
     window.onbeforeunload = function() { return 'You have unsaved changes!'; }
  
    });
  
   });
  </code></pre>