422
422

Reputation: 5770

hyperlink to jquery tabs

We have our accordion tabs ( horizontal as follows )

<ul class="tabs"> 
    <li><a href="#tab1"><span class="upArrow">Inbox (2)</span></a></li> 
    <li><a href="#tab2"><span class="downArrow">Sent (8)</span></a></li>
    <li><a href="#tab3"><span class="composeMssg">Compose</span></a></li>
    </ul> 

We have the tab titles as such

<div class="tab_content_container"> 

    <div id="tab1" class="tab_content" style="font-size: 12px;"> 

Content and then closing divs, and remainder of tabs linking to the href's as you do.

Issue is ,

How can I link to #tab2 from external link and open that tab on page load.

Upvotes: 0

Views: 455

Answers (2)

Robin Maben
Robin Maben

Reputation: 23094

Say you want to select a particular tab via an external link, then you need to do..

$("#tabs").tabs("select", "#tabid");

So, for selecting tab2 on page load..

$(function(){
    $("#tabs").tabs("select", "#tab2");
});

Upvotes: 1

atx
atx

Reputation: 5079

Put this in a script tag in the body tag of your html.

$("#tab2").hide()
$("#tab3").hide()
$("#tab1").show()

Upvotes: 0

Related Questions