title: jQuery UI Modal Popup Window - Button Click
body: <p>I' m trying to have my register button in a form lead in a modal window which will show the input of user's info. I have 3 problems so far.</p>
  
  <ol>
  <li>After closing the modal window, my form is missing </li>
  <li>I want to rename the "close" button of the modal window to "confirm" if possible</li>
  <li>After closing (confirm) the modal window, i want to go back to the web page and the form to be empty (without the previous input)</li>
  </ol>
  
  <p>My code so far:</p>
  
  <p>HTML - Form :</p>
  
  <pre><code>&lt;div id="myForm"&gt;
      &lt;form name="myForm" method="POST"&gt;
          &lt;fieldset&gt;
              &lt;legend&gt;Register your interest&lt;/legend&gt;
              &lt;div id="divpopup"&gt;
              &lt;p&gt;&lt;label class="title" for="name"&gt;Your name:&lt;/label&gt;
                  &lt;input type="text" name="name" id="name"&gt;&lt;br /&gt;
                  &lt;label class="title" for="email"&gt;Your email:&lt;/label&gt;
                  &lt;input type="text" name="email" id="email"&gt;&lt;/p&gt;
                  &lt;label class="title" for="persons"&gt;Persons:&lt;/label&gt;
                  &lt;input id="personsId" type="text" name="persons" id="persons"&gt;&lt;/p&gt;
              &lt;p&gt;&lt;label for="location" class="title"&gt;Your closest center:&lt;/label&gt;
                  &lt;select class="target" name="location" id="location"&gt;
                       &lt;option value="ny"&gt;New York&lt;/option&gt;
                       &lt;option value="il"&gt;Chicago&lt;/option&gt;
                       &lt;option value="ca"&gt;San Francisco&lt;/option&gt;
                  &lt;/select&gt;&lt;/p&gt;
              &lt;span class="title"&gt;Are you a member?&lt;/span&gt;
              &lt;label&gt;&lt;input type="radio" name="member" value="yes" /&gt; Yes&lt;/label&gt;
              &lt;label&gt;&lt;input type="radio" name="member" value="no" /&gt; No&lt;/label&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/fieldset&gt;
      &lt;div class="submit" id="myButton"&gt;&lt;input type="button" id="btnclick" value="Register" /&gt;&lt;/div&gt;
      &lt;/form&gt;
      &lt;div class="quantity"&gt;&lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>SCRIPT - Modal Window :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt; //register modal window
      $(function() {
          $("#btnclick").click(function() {
              $("#divpopup").dialog({
                  title: "Your Input",
                  width: 500,
                  height: 500,
                  modal: true,
                  buttons: {
                      Close:
                      function() {
                          $(this).dialog('close');
                      }
                  }
              });
          });
      })
  &lt;/script&gt;
  </code></pre>