title: Open Bootstrap 4 Modal via JavaScript by clicking a link
body: <p>I want to open a modal when I click on a link.
  Unfortunately I couldn't change the HTML of the link. I could only change the content of <code>href</code>.</p>
  
  <p>Like this: </p>
  
  <pre><code>&lt;a href="#Modal"&gt;Open modal&lt;/a&gt;
  </code></pre>
  
  <p>I could not add data-attributes or any other HTML.</p>
  
  <p>In the docs I found a way to open the modal via JavaScript. I added this code to my site:</p>
  
  <pre><code>$('#Modal').modal();
  </code></pre>
  
  <p>It works but the modal opens immediately after the page loads.
  I need it to open after I click on the link.</p>
  
  <p>Is there a way to do this?</p>
  
  <p>Here's my modal:</p>
  
  <pre><code>&lt;div class="modal" id="Modal" tabindex="-1" role="dialog" aria-labelledby="ModalTitle" aria-hidden="true"&gt;
      &lt;div class="modal-dialog modal-dialog-centered" role="document"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;p class="h5 modal-title" id="ModalTitle"&gt;Modal Title&lt;/p&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                  Content
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>