I am using the following code to switch tabs. But the problem is if i put the tabe id in url with #, it will not goto that specific tab.
<a href="index.php#tab2">Tab 2</a>
<a href="index.php#tab3">Tab 3</a>
Below is the code
jQuery(document).ready(function() {
jQuery('.tabs .tab-links a').on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
// Show/Hide Tabs
jQuery('.tabs ' + currentAttrValue).show().siblings().hide();
// Change/remove current tab to active
jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
e.preventDefault();
});
});
html code
<ul class="tab-links">
<li class="active"><a style="" href="#tab1">Account</a></li>
<li><a href="#tab2">Jobs Posted</a></li>
<li><a href="#tab3">Messages</a></li>
<li><a href="#tab4">Post A Job</a></li>
</ul>
<div class="tab-content">
<div id="tab1" class="tab active" style="padding-bottom:30px;">
</div>
<div id="tab1" class="tab" style="padding-bottom:30px;">
</div>
<div id="tab1" class="tab" style="padding-bottom:30px;">
</div>
</div>