MajuiF
MajuiF

Reputation: 397

jQuery Accordion display specific tab

I'm rusty at javascript and HTML, and trying to get back into it.

Here's the sample code of the element I'd like to modify:

      <div id="tabContainer" class="table">
         <h1>Container</h1>
         <ul class="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="tab_display">
            <div id="tab1" class="tab_content"></div>
            <div id="tab2" class="tab_content"></div>
            <div id="tab3" class="tab_content"></div>
         </div>
      </div>

I'm using a version of jQuery Accordion to switch between tabs,and it works without any trouble. Clicking on tab 2, while tab 1 is selected, will clear 'tab_display' and display the contents of tab 2.

I would like to control what tab is displayed, by clicking for a button for example.

If tab 1 is being displayed and I click another button on the page, I'd like for a specific tab to be displayed (show the selection on the 'tabs' list, and also show the contents in the 'tab_dsiplay').

How can I do this? Thanks!

Upvotes: 0

Views: 869

Answers (1)

sudoJustin
sudoJustin

Reputation: 60

Try using the solution here open-jquery-accordion-panel-with-link-outside-of-acccordion

Demo here.

Upvotes: 1

Related Questions