title: Bootstrap 5 Tabs with Next/Prev Button
body: <p>How can I add prev/next buttons to bootstrap 5 tabs?</p>
  <p>I've tried to use recommended methods for previous versions but the structure must be different. What am I missing here with the jQuery?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.btnNext').click(function() {
    $('.nav-tabs &gt; .active').next('li').find('a').trigger('click');
  });
  $('.btnPrevious').click(function() {
    $('.nav-tabs &gt; .active').prev('li').find('a').trigger('click');
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"&gt;
  &lt;script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"&gt;
  &lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"&gt;&lt;/script&gt;
  
  &lt;!-- Nav tabs --&gt;
  &lt;ul class="nav nav-tabs"&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link active" data-bs-toggle="tab" href="#home"&gt;Home&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link" data-bs-toggle="tab" href="#menu1"&gt;Menu 1&lt;/a&gt;
    &lt;/li&gt;
    &lt;li class="nav-item"&gt;
      &lt;a class="nav-link" data-bs-toggle="tab" href="#menu2"&gt;Menu 2&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;!-- Tab panes --&gt;
  &lt;div class="tab-content"&gt;
    &lt;div class="tab-pane container active" id="home"&gt;
      &lt;h1&gt;Home&lt;/h1&gt;
      &lt;a class="btn btn-primary btnNext"&gt;Next&lt;/a&gt;
  
    &lt;/div&gt;
    &lt;div class="tab-pane container fade" id="menu1"&gt;
      &lt;h1&gt;Menu 1&lt;/h1&gt;
      &lt;a class="btn btn-primary btnPrevious"&gt;Back&lt;/a&gt;
      &lt;a class="btn btn-primary btnNext"&gt;Next&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="tab-pane container fade" id="menu2"&gt;
      &lt;h1&gt;Menu 2&lt;/h1&gt;
      &lt;a class="btn btn-primary btnPrevious"&gt;Back&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>