Search code examples
jqueryhyperlinktabslinkerinternal

How to link from a jQuery tab to another tab? (specific jQuery Tabbed Interface)


I'm working on a site that uses this specific jQuery tab interface:

http://www.queness.com/post/106/jquery-tabbed-interfacetabbed-structure-menu-tutorial

I was asked to make a link on tab 1, that opens for example tab 4 (it has to behave as I would click directly on tab 4, so without reloading the page). I have tried everything that I can think of. I also searched a couple of hours for a solution or a hint, but everything I found was not applicable on this tab system.

Any help would be much appreciated.

Ondrej


Solution

  • The easiest way regarding your code would be:

    $('#tabMenu li').eq(2).click()
    

    For example, if you want to link to the second tab, use this:

    <a onclick="$('#tabMenu li').eq(2).click()">Click it</a>
    

    Notice that eq() starts with 0. So for example eq(4) selects the fifth tab.