This is my HTML code:
<div class="tab-content">
<div id="tab1" class="tab active">
<p>Hotels In Asia</p> <br>
<div class="asia1">
<p class="para1">$499 for 1 night</p>
<button>Book Now</button>
<a href="#"><p class="para2">See Photo</p></a>
</div>
<div class="asia1">
<p class="para1">$499 for 1 night</p>
<button>Book Now</button>
<a href="#"><p class="para2">See Photo</p></a>
</div>
<div class="asia1">
<p class="para1">$499 for 1 night</p>
<button>Book Now</button>
<a href="#"><p class="para2">See Photo</p></a>
</div>
<div class="tab11">
<div class="place active">
<p>Places In Asia</p>
<div class="asia">
<img src="../images/asia_hotel_1.jpg" alt="Asia hotel">
</div>
<div class="asia">
<img src="../images/asia_hotel_2.jpg" alt="Asia hotel">
</div>
<div class="asia">
<img src="../images/asia_hotel_3.jpg" alt="Asia hotel">
</div>
</div>
</div> <!-- tab11 end-->
</div><!-- tab1 end-->
<div id="tab2" class="tab">
<p>Hotels In Europe</p>
<p>para of tab2</p>
</div>
<div id="tab3" class="tab">
<p>Tab 3 content here!</p>
<p>para of tab3</p>
</div>
<div id="tab4" class="tab">
<p>Tab 4 content here!</p>
<p>para of tab4</p>
</div>
</div>
</div>
And this is my jquery which i used for multiple tabs within a single page.
<script type="text/javascript">
$(document).ready(function() {
$('.tab-links a').on('click', function(e) {
var currentAttrValue = $(this).attr('href');
// Show/Hide Tabs
$('.tabs ' + currentAttrValue).delay(400).slideDown(400);
$('.tabs ' + currentAttrValue).siblings().slideUp(400);
// Change/remove current tab to active
$(this).parent('li').addClass('active').siblings().removeClass('active');
e.preventDefault();
});
});
</script>
When I open my html page, all the content of other tabs also displaying in first tab. But when I switch to other tabs, contents are displayed fine.