title: How to navigate to a new bootstap 4 tab on the same page from a sidebar link?
body: <p>I'm unable to get sidebar links to navigate to bootstrap 4 tabs on the center page <a href="https://stackoverflow.com/a/54085729/381082">using this technique</a>. Here is the javascript in my <code>_SidebarLayout.cshtml</code>: </p>
  
  <pre><code>&lt;script&gt;
      function selectTabNamedInUrlHash() {
          let selectedTab = window.location.hash;
          $('.nav-link[href="' + selectedTab + '"]').trigger('click');
      }
  
      jQuery(document).ready(function ($) {
          selectTabNamedInUrlHash();
      })
  &lt;/script&gt;
  </code></pre>
  
  <p>A sidebar anchor links to the page and adds a fragment (hash) to the href of the tab I want to navigate to (url end: SPC#SpcFilm). The sidebar link also calls the above function.</p>
  
  <pre><code>&lt;a onclick="selectTabNamedInUrlHash();" asp-page="/SPC/Index" asp-fragment="SpcFilm"&gt;Film&lt;/a&gt;
  </code></pre>
  
  <p>On Index.cshtml the Bootstrap 4 tab is identified by <code>href="#SpcFilm"</code> This solution works when navigating to a new page, but it's not working when navigating to another tab on the same page.</p>