title: Javascript confirmation dialog box takes three clicks of "cancel" to close
body: <p>The following code is guilty of generating this unusual problem:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
                  $(document).ready(function () {
                      $('.deleteRow').click(function (event) {
                          event.preventDefault();
                          if (confirm('Delete?')) {
                              var $t = $(this);
                              $.post($(this).attr('href'), function (data) {
                                  if (data) {
                                      $t.parent().parent().remove();
                                  }
                              });
                          }
                          return false;
                      });
                  });
              &lt;/script&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;td&gt; &lt;%= Html.ActionLink("&lt;-Delete", "Delete", new {quoteID = quote.QuoteID}, new {@class= "deleteRow"}) %&gt;&lt;/td&gt;
  
  &lt;td&gt; &lt;a class="deleteRow" href="/Quote/Delete/56"&gt;&amp;lt;-Delete&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>There we are.</p>
  
  <pre><code>    &lt;tbody&gt;
  
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;p&gt;
      asd&lt;/p&gt;
  &amp;lt;div firebugversion=&amp;quot;1.5.4&amp;quot; id=&amp;quot;_firebugConsole&amp;quot; style=&amp;quot;display: none;&amp;quot;&amp;gt;
  
      &amp;amp;nbsp;&amp;lt;/div&amp;gt;
  &amp;lt;br /&amp;gt;
  
              &lt;/td&gt;
              &lt;td&gt;
                  2345
              &lt;/td&gt;
              &lt;td&gt;
                  7/28/2010 3:26:10 PM
              &lt;/td&gt;
  
              &lt;td&gt; &lt;a class="deleteRow" href="/Quote/Delete/56"&gt;&amp;lt;-Delete&lt;/a&gt;&lt;/td&gt;
              &lt;script type="text/javascript"&gt;
                  $(document).ready(function () {
                      $('.deleteRow').click(function (event) {
                          event.preventDefault();
                          event.stopPropagation();
                          if (confirm('Delete?')) {
                              var $t = $(this);
                              $.post($(this).attr('href'), function (data) {
                                  if (data) {
                                      $t.parent().parent().remove();
                                  }
                              });
                          }
                          return false;
                      });
                  });
              &lt;/script&gt;
  
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;
                  Now is the time for all good men to come to the aid of their parties.
              &lt;/td&gt;
  
              &lt;td&gt;
  
              &lt;/td&gt;
              &lt;td&gt;
                  7/6/2010 10:13:44 PM
              &lt;/td&gt;
              &lt;td&gt; &lt;a class="deleteRow" href="/Quote/Delete/2"&gt;&amp;lt;-Delete&lt;/a&gt;&lt;/td&gt;
              &lt;script type="text/javascript"&gt;
                  $(document).ready(function () {
                      $('.deleteRow').click(function (event) {
                          event.preventDefault();
                          event.stopPropagation();
                          if (confirm('Delete?')) {
                              var $t = $(this);
                              $.post($(this).attr('href'), function (data) {
                                  if (data) {
                                      $t.parent().parent().remove();
                                  }
                              });
                          }
                          return false;
                      });
                  });
              &lt;/script&gt;
  
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;
                  I&amp;#39;m a loser
              &lt;/td&gt;
              &lt;td&gt;
                  146
              &lt;/td&gt;
              &lt;td&gt;
  
                  7/6/2010 9:11:42 PM
              &lt;/td&gt;
              &lt;td&gt; &lt;a class="deleteRow" href="/Quote/Delete/1"&gt;&amp;lt;-Delete&lt;/a&gt;&lt;/td&gt;
              &lt;script type="text/javascript"&gt;
                  $(document).ready(function () {
                      $('.deleteRow').click(function (event) {
                          event.preventDefault();
                          event.stopPropagation();
                          if (confirm('Delete?')) {
                              var $t = $(this);
                              $.post($(this).attr('href'), function (data) {
                                  if (data) {
                                      $t.parent().parent().remove();
                                  }
                              });
                          }
                          return false;
                      });
                  });
              &lt;/script&gt;
  
          &lt;/tr&gt;
  
      &lt;/tbody&gt;
  </code></pre>
  
  <p>Thanks for all the responses, btw.</p>