<div class="product-tabs">
<ul class="tabs">
  <li data-tab="description" class="selected">Description</li>
  <li data-tab="details">Details</li>
  <li data-tab="returnPolicy">Return Policy</li>  
</ul>
<div class="tab-content selected" data-tab="description">
  <p> Description goes here </p>
</div>
<div class="tab-content" data-tab="details">
  <p> Details goes here </p>
</div>
<div class="tab-content" data-tab="returnPolicy">
  <p> Return Policy goes here </p>
</div>
</div>

<div class="bazaar-tabs">
<ul class="tabs">
  <li data-tab="ratings" class="selected">Ratings and Reviews</li>
  <li data-tab="questions">Questions and Answers</li>  
</ul>
<div class="tab-content selected" data-tab="ratings">
  <p> Ratings and Reviews go here </p>
</div>
<div class="tab-content" data-tab="questions">
  <p> Questions and answers go here </p>
</div>
</div>
body {
  color: #333;
  font-family: sans-serif;
  padding: 1em;
}

.tabs {
  margin: 0;
  padding: 0;
}

.tabs li {
  display: inline-block;
  padding: 10px 10px 10px;
  background: white;
  border-color: #000;
  border-style: solid solid none solid;
  border-width: 1px;
  vertical-align: bottom;
  color: #aeaeae;  
  margin-left: -6px;
  cursor: pointer;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

.tabs li.selected {
  background: white;
  position: relative;
  border-color: #000;
  padding-bottom: 10px;
  padding-top: 11px;
  top: 1px;
  color: #565656;
}

.tab-content {
  background: white;
  padding: 20px 10px;
  border: solid #000 1px;
  margin-left: -6px;
  display: none;
  margin-bottom: 20px;
}

.tab-content.selected {
  display:block;
}

/* Tabs render differently in webkit vs other browsers */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  .tab-content {
    margin-left: -5px;
  }
  .tabs li {
    margin-left: -5px;
  }
}
jQuery(document).ready(function() {
  
  //Tabs functionality, specific for each tab to avoid conflict
  jQuery(".product-tabs .tabs li").on("click", function() {
    var tabToShow = jQuery(this).data('tab');
    jQuery(".product-tabs li.selected").removeClass("selected");  
    jQuery(this).addClass("selected");    
    jQuery('.product-tabs .tab-content').each(function(){
				if(jQuery(this).data('tab') === tabToShow){
					jQuery(this).addClass('selected');
				} else {
					jQuery(this).removeClass('selected');
				}
		});    
  });
  
  jQuery(".bazaar-tabs .tabs li").on("click", function() {
    var tabToShow = jQuery(this).data('tab');
    jQuery(".bazaar-tabs li.selected").removeClass("selected");  
    jQuery(this).addClass("selected");    
    jQuery('.bazaar-tabs .tab-content').each(function(){
				if(jQuery(this).data('tab') === tabToShow){
					jQuery(this).addClass('selected');
				} else {
					jQuery(this).removeClass('selected');
				}
		});    
  });
  
});
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js