title: Bootstrap modal - close modal when "call to action" button is clicked
body: <p>I have a external link inside my modal, and I want the modal to hide after the user has clicked on the link. How do I do that?</p>
  <p>Here is my code:</p>
  <pre><code>&lt;div class=&quot;modal hide fade&quot; id=&quot;modalwindow&quot;&gt;
    &lt;div class=&quot;modal-header&quot;&gt;
      &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/button&gt;
      &lt;h3&gt;Title&lt;/h3&gt;
    &lt;/div&gt;
    &lt;div class=&quot;modal-body&quot;&gt;
      &lt;p&gt;You need to do a search on google.com for that.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div class=&quot;modal-footer&quot;&gt;
      &lt;a id=&quot;closemodal&quot; href=&quot;https://www.google.com&quot; class=&quot;btn btn-primary&quot; target=&quot;_blank&quot;&gt;Launch google.com&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script type=&quot;text/javascript&quot;&gt;
      $('#closemodal').modal('hide');
  &lt;/script&gt;
  </code></pre>