I am currently working on a script that is well-known, and everything is functioning perfectly. However, I want to change it so that when the page is first opened, it displays the second tab instead of the first one (the first tab being a mail compose tab and the second tab being the actual inbox).
Below is the JavaScript code:
<script type="text/javascript">
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
});
</script>
And here is the HTML for the tabs:
> <ul class="tabs">
> <li><a href="#compose" class="compose"></a></li>
> <div id="mail_sidebar_top">
> <li><a href="#inbox" class="inbox">Inbox(0)</a></li>
> <li><a href="#sent_mail" class="sent_mail">Sent Mail(0)</a></li>
> <li><a href="#trash" class="trash">Trash(0)</a></li>
> <li><a href="#reported" class="reported">Reported</a></li>
> <li><a href="#drafts" class="drafts">Drafts</a></li>
>
> </div><!---end mail_sidebar_top--->
>
> <div id="mail_sidebar_middle">
> <li><a href="#notifications" class="notifications">Notifications</a></li>
> <li><a href="#alerts" class="alerts">Alerts</a></li>
>
> </div><!---end mail_sidebar_top--->
>
> </ul>
Any assistance would be greatly appreciated.