ask for saving before leaving the page?
<p>based on <a href="http://stackoverflow.com/questions/2469999/jquery-how-to-check-if-form-elements-are-not-empty">this post</a> I am asking confirmation from user to save data 
before leaving the page,if user enter any data in the textfields.</p>

<p>but I am getting below error when page loads and my form id is "Form1"</p>

<p><img src="http://i.stack.imgur.com/IqBzr.jpg" alt="enter image description here"></p>

<pre><code>&lt;script type="text/javascript" language="javascript"&gt;
     window.onload = function (e) {
        var form_has_been_modified = 0;
          $("form[id^='Form1']").on("change keyup", ":input", function () {
          form_has_been_modified = 1;
        })
        };
     window.onbeforeunload = function (e) {
           if (!form_has_been_modified) {
             return;
        }
        var message = "Do you want to save the data before leave the page?";
        var e = e || window.event;

         // For IE and Firefox prior to version 4
        if (e) {
              e.returnValue = message;
        }
        // For Safari
         return message;
             };


        &lt;/script&gt;
</code></pre>

<p>how to solve this issue?</p>

<p><strong>Updated: in HTML source code shows  <code>&lt;form name="aspnetForm" method="post" action="EditMember.aspx?Id=3664653" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm" enctype="multipart/form-data"&gt;</code>, How to use this form in above code?</strong> </p>
