JSFiddle - React, Tailwind, and code Playground

by GMK Hussain

HTML

<ul class="nav nav-tabs">
  <li class=""><a data-toggle="tab" href="#tab1">
  				                    History of HBOT
  </a></li>
  <li class="active"><a data-toggle="tab" href="#tab2">
    				                    How does HBOT work  </a></li>
  
  
  <li><a data-toggle="tab" href="#tab3">
  	                    Benefits of HBOT	</a></li>
</ul>

JavaScript

var pathname = window.location.href; 
jQuery(document).ready(function() {

var tabs = ['','http://ecommercehouse.com/projects/lakeshore/backend/what-is-hbot/?tab1','http://ecommercehouse.com/projects/lakeshore/backend/what-is-hbot/?tab2','http://ecommercehouse.com/projects/lakeshore/backend/what-is-hbot/?tab3'];


    
jQuery.each( tabs, function( key, value ) {
    alert( "tabs"+key );
if ( pathname == tabs+key ){
		jQuery(".nav-tabs li").removeClass("active");
		jQuery(".nav-tabs li:nth-child("+key+")").addClass("active");
			jQuery(".tab-pane").removeClass("active");
			jQuery("#tab"+key).addClass("active");
}

});

});