title: Before saving the data Closing popup window show alert message?
body: <p>In popup page after enter the data before clicking the save button user try to close the popup in (X mark) i want to show the alert message(You did not save your changes). if user click the save button no need to show the alert message.</p>
  
  <p>using javascript how can i do this ?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   $(document).ready(function () {
  
       var unsaved = false;
       $('#Button1').click(function () {
           unsaved = true;
       });
  
       function unloadPage() {
           if (unsaved) {
               return "You have unsaved changes on this page.?";
           }
       }
  
       window.onbeforeunload = unloadPage;
   });
  
  &lt;/script&gt;
  </code></pre>