title: Turn the tab active based on the current url
body: <p>I have some list items in the "#registration_form_list" list. The default active list item is the list item with id "#generalInfo". But I want that when a url like
  this "<a href="http://proj.test/user/profile?user=1#myTickets" rel="nofollow noreferrer">http://proj.test/user/profile?user=1#myTickets</a>" is accessed the tab that stays active is the "My Tickets" tab. </p>
  
  <p>So I want to turn the tab active based on the current url. But its not working with the jQuery below.</p>
  
  <p>Do you know why?</p>
  
  <p>Html:</p>
  
  <pre><code>&lt;ul class="nav nav-pills bg-light-gray registration_form_list" role="tablist"&gt;
      &lt;li class=""&gt;
          &lt;a class="nav-link active" href="#generalInfo" data-toggle="tab" role="tab"&gt;
              &lt;i class="fa fa-user" aria-hidden="true"&gt;&lt;/i&gt; &lt;span class="d-none d-lg-inline-block"&gt;General Info&lt;/span&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;li class="disabled"&gt;
          &lt;a class="nav-link" href="#myTickets" data-toggle="tab" role="tab"&gt;
              &lt;i class="fa fa-calendar" aria-hidden="true"&gt;&lt;/i&gt; &lt;span
                      class="d-none d-lg-inline-block"&gt;My Tickets&lt;/span&gt;&lt;/a&gt;
      &lt;/li&gt;
      &lt;!-- more list items --&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>   var path = window.location.href;
  
          $('.registration_form_list a').each(function () {
              var hash = $(this).attr('href').split('#')[1];
              //alert(hash); appaers
              if (this.href === path) {
                  // alert('test'); dont appears
                  $('.registration_form_list a').removeClass('active');
                  $('a[href="#'+hash+'"]').addClass('active');
              }
          });
  </code></pre>
  
  <p>For example I have a method where the user is redirected to the "<a href="http://proj.test/user/profile?user=1#myTickets" rel="nofollow noreferrer">http://proj.test/user/profile?user=1#myTickets</a>" but the tab that remains active is the "#generalInfo" when the user accesses the page.</p>
  
  <pre><code>return redirect(route('user.index', ['user' =&gt; Auth::id()]).'#myTickets');
  </code></pre>
  
  <p>The tabs content are inside tab-content with the corresponding id like:</p>
  
  <pre><code>&lt;div class="tab-content registration_body bg-white" id="myTabContent"&gt;
  
      &lt;div class="tab-pane fade show active clearfix" id="generalInfo" role="tabpanel" aria-labelledby="home-tab"&gt;
      &lt;!-- #generalInfo content --&gt;
      &lt;/div&gt;
  
      &lt;div class="tab-pane clearfix fade" id="myTickets" role="tabpanel" aria-labelledby="contact-tab"&gt;
          &lt;!-- #myTickets content --&gt;
      &lt;/div&gt;
      &lt;!-- other tabs --&gt;
  &lt;/div&gt;
  </code></pre>