title: How to make a modal confirmation dialog before submitting a form?
body: <p>I am a beginner in web/javascript programming and wonder if anyone can give me a kick start simple example of a modal confirm dialog just before a form with multiple submit buttons being submitted using a pre-defined button? I stumbled upon jQuery and SimpleModal and wonder if it would fit my ASP MVC project.</p>
  
  <p>I ended up in the following non-working codes, I think my 1st problem is do not know how to return a value from the dialog?:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
      $("form").submit(function(ev) {
              return confirm("Confirm?");
          });
      });
  
      function confirm(message) {
          $("#confirm").modal({
              close: true,
              overlayId: "confirmModalOverlay",
              containerId: "confirmModalContainer",
              onShow: function modalShow(dialog) {
                  dialog.overlay.fadeIn("slow", function() {
                      dialog.container.fadeIn("fast", function() {
                          dialog.data.hide().slideDown("slow");
                      });
                  });
  
                  dialog.data.find(".confirmMessage").append(message);
                  dialog.data.find(".btnYes").click(function() {
                      $.modal.close();                                       
                  });
              }
          })
      }        
  &lt;/script&gt;
  
  
  &lt;div id="confirm" style="display:none"&gt;
      &lt;a href="#" title="Close" class="modalCloseX simplemodal-close"&gt;x&lt;/a&gt;
      &lt;div class="confirmHeader"&gt;&lt;span&gt;Confirm&lt;/span&gt;&lt;/div&gt;
      &lt;p class="confirmMessage"&gt;&lt;/p&gt;
      &lt;div class="buttons"&gt;
          &lt;div class="btnYes"&gt;Yes&lt;/div&gt;&lt;div class="btnNo simplemodal-close"&gt;No&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It would be nice if anyone direct me to somewhere online for a crash course of web programming :)</p>