title: twitter-bootstrap modal confirm dialog
body: <p>I can't figure out how to implement confirm dialog with bootstrap modal, this is my code that doesn't work:</p>
  
  <pre><code>&lt;div id="id" class="modal hide"&gt;
      &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
          &lt;h3&gt;title&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
          &lt;p&gt;confirm message&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
          &lt;button data-dismiss="modal" class="btn"&gt;No&lt;/button&gt;
          &lt;button id="id-confirm" class="btn btn-primary"&gt;Yes&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;a id="a" href="http://example.com"&gt;link&lt;/a&gt;
  &lt;script type="text/javascript"&gt;
      var confirmed = false;
      var modal = $('#id');
      var clickee = $('#a');
  
      clickee.click(function() {
          if (!confirmed) {
              modal.modal('show');
              return false;
          }
      });
      $('#id-confirm').click(function() {
          confirmed = true;
          clickee.click();
          modal.modal('hide');
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>When I click on the link <code>link</code>, the dialog pops up, but when I confirm it, no redirect happens, when I click on the link <code>link</code> again, I get redirected.</p>
  
  <p>I could just redirect to the href of the link, I know that, but I want to make it reusable, instead of link (<code>a</code> element) I could also want to use button or define onclick event on the button.</p>
  
  <p>Thanks for your answers.</p>