title: JQuery on submit show dialog
body: <p>First sorry for my bad English.</p>
  
  <p>I would like to show a confirmation layer (id="confirmwin") before submitting a form (id="form"). There is another button (id="yes") to submit the form.</p>
  
  <p>I tried this:</p>
  
  <p>Layer:</p>
  
  <pre><code>&lt;div id="confirmwin" style="display:none"&gt;
  Are you sure to submit?&lt;br&gt;
  &lt;a href="#" id="yes"&gt;Yes&lt;/a&gt; &lt;a href="#" onclick="closeconfirmwin()"&gt;No&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>$(document).ready(function(){
    $("#yes").click( function() {
      $("#form").off("submit").submit();
    });
    $("#form").on("submit", function() {
      $('#confirmwin').show();
      return false;
    });
  });
  </code></pre>
  
  <p>Sometimes (not always) it looks like it's in an endless loop.</p>
  
  <p>Perhaps the #yes click event's off event goes wrong.</p>