title: Bootstrap 4 Active Tab based on link
body: <p>I'd like to activate a tab when a specific link clicked.
  This is the code sniopet from bootstrap.</p>
  
  <pre><code>&lt;ul class="nav nav-pills mb-3" id="pills-tab" role="tablist"&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true"&gt;Home&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false"&gt;Profile&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false"&gt;Contact&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  &lt;div class="tab-content" id="pills-tabContent"&gt;
    &lt;div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab"&gt;...&lt;/div&gt;
    &lt;div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab"&gt;...&lt;/div&gt;
    &lt;div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab"&gt;...&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried using jquery:</p>
  
  <pre><code>  $(".tab-pane").removeClass("show active");
  $("#" + activeTab).addClass("show active");
  </code></pre>
  
  <p>but it doesn't work at all, any help?
  thanks</p>