Setting tab on click of a link

Setting tab on click of a link

Hey all.

I'm using jQuery tabs and onload of the page, the first tab is selected by default. What I want to do is set tab '3' to open when a link is clicked.

For example, I have 2 or 3 tabs available. There will always be 2 tabs and if a certain condition is true, a third tab is available. When a 3rd tab is available, a link is displayed that can be clicked. When that that link is clicked, I want to display the "tab area" and automatically view the contents of the 3rd tab.

The tabs are inside a <div> and that div is hidden. When the link is clicked, the div is shown, which is when I want the default viewed tab to be the 3rd, instead of the 1st.

This is the line to set the first tab to be selected by default
var $tabs = $('#detail_tabs').tabs();  /* first tab selected */, I changed it to var $tabs = $('#detail_tabs').tabs(2);  /* first tab selected */ but that didn't work.

Any suggestions would be appreciated.