title: Making a confirm box
body: <p>I am trying to make my own dialog box. I want to use jquery for this. For some buttons on my site I need a confirmation dialog (like "Are you sure you want to delete" yes/no). When the dialog is active, the rest of the site should not be clickable.</p>
  
  <p>So, I made this:</p>
  
  <pre><code>&lt;div class="overlay" id="overlay" style="display:none;"&gt;
    &lt;div class="overlaycontent" id="overlaycontent"&gt;
      &lt;div id="overlaytext" class="overlaytext "&gt;
        &lt;span id="overlaymessage" class="mediumtext bold"&gt;Deze klant verwijderen?&lt;/span&gt;
        &lt;br&gt;&lt;br&gt;
        &lt;button id="nobutton" class="button1 highbutton hand" onclick="confirmno()"&gt;Nee&lt;/button&gt;&amp;nbsp;&amp;nbsp;
        &lt;button id="yesbutton" class="button2 highbutton hand" onclick="confirmyes()"&gt;Ja&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>ID overlay is over the whole page.
  ID overlaycontent creates a white box on top of it.
  ID overlaytext centers the message
  ID overlaymessage contains the question/message.
  ID nobutton is the button to say no :)
  ID yesbutton is.. guess what :)</p>
  
  <p>Now, the javascript to display a message:</p>
  
  <pre><code>function confirm(message,nobutton,yesbutton){
  $('#overlaymessage').html(message);
  $('#nobutton').html(nobutton);
  $('#yesbutton').html(yesbutton);
  $('#overlay').show();
  }
  function confirmno(){
  $('#overlay').hide();
  }
  function confirmyes(){
  ????
  }
  </code></pre>
  
  <p>So far, it works fine (except the yes button of course, please read further on), but for the next step I lack the knowledge. Say that I have a button somewhere to delete a user on my website.</p>
  
  <pre><code>&lt;button class="redbutton" onclick="deleteuser(22)"&gt;
  </code></pre>
  
  <p>The button needs javascript like:</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  function deleteuser(userid){
    confirm('Delete user?','No','Yes');
    ??????  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Now where the question marks are, I want the function to do something based on the fact the user clicked yes or no. How to catch this? I don't have any idea. Please help me out. I don't want to use Jquireui.dialog.</p>