title: Alert for unsaved changes in form
body: <p>I want to write Jquery code in master file, so that if there if user changes page and there is any unsaved changes user should get alert. 
  I got one answer from this: <a href="https://stackoverflow.com/questions/155739/detecting-unsaved-changes-using-javascript">link</a></p>
  
  <p>However in most solution I will have to write code on all pages. I want it to write only at one place so that everybody dont have to worry to write it in their modules. My code is like:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var isChange;
      $(document).ready(function () {
          $("input[type='text']").change(function () {
              isChange = true;
          })
      });
      $(window).unload(function () {
          if (isChange) {
              alert('Handler for .unload() called.');
          }
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>But everytime i make changes in text boxes .change() event is not firing.</p>
  
  <p>What can be wrong in the code?</p>
  
  <p>EDIT:
  I changed .change() to .click and it is fired. i am using jquery 1.4.1..is it because of jquery version that change() is not working?</p>