title: JQuery dialog box before closing browser window
body: <p>I understand from other posts that the only way to handle this is through a browser dialogue box that can't be edited. What I am having a problem with is that box appearers no matter how I leave the page. The page has a save and delete button that are the correct ways to leave the page and I don't want the dialogue box to appear for them.</p>
  
  <p>Here is the JQuery I have</p>
  
  <pre><code>$(document).ready(function(){
  //save or delete
    window.onbeforeunload = function() {
                var message = 'You have unsaved changes, please stay and save or delete them.';
                return message;
            }
  }); 
  </code></pre>
  
  <p>and the save and delete button are:</p>
  
  <pre><code>  &lt;a id='savenewscopesheet' class='taskbutton'&gt;Save&lt;/a&gt;
    &lt;a id='deletenewscopesheet' class='taskbutton'&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <p>I am using more JQuery to handle their function hence they don't have an href.</p>