I am using HTML / JQuery to have tabs on my page and it works fine.
Here is the code:
$("#content div").hide(); // Initially hide all content
$("#tabs li:first").attr("id", "current"); // Activate first tab
$("#content div:first").fadeIn(); // Show first tab content
$('#tabs li a').click(function (e) {
e.preventDefault();
if ($(this).attr("id") == "current") { //detection for current tab
return
} else {
$("#content div").hide(); //Hide all content
$("#tabs li").attr("id", ""); //Reset id's
$(this).parent().attr("id", "current"); // Activate this
$($(this).attr('href')).fadeIn(); // Show content for current tab
}
});
and then the html:
<ul id="tabs">
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
<li><a href="#tab3">Tab 3</a></li>
</ul>
<div id="tab1">
TAB 1
</div>
<div id="tab2">
TAB 2
</div>
<div id="tab3">
TAB 3
</div>
My problem is that I need to find a way of linking straight to the tabs when required.
Any ideas on how to do this?