I'm writing a PHP site where the tabs are defined before the program picks up which tab it prefers to open so I can't use the 'selected' option in the creation. How can I select a default tab as the rest of the page is being built in PHP. Please be painfully specific. ;) I've seen a lot of hints at what code needs to be used but so far my tests have not been successful. The Accordion widget has exactly what I need with the 'active' method, but tabs doesn't seem to have anything similar.
One option would be to simply add the selected class while constructing the HTML...: <li class="ui-tabs-selected">...</li> and initializing tabs without selected option: $(...).tabs(); --Klaus On 8 Apr., 21:39, Das123 <dgspr...@gmail.com>
Still no luck. Here is what is happening... In the head I have the following code to implement the tabs: $(function() { $("#tab_block").tabs({ }); }); In the body I have this php code to build the tabs wanting tab-2 to open by default: // Prepare tabs echo "<div id=\"tab_block\">\n"; // Build tab navigation echo "<ul> <li class=\"e_objective_tab\"><a href=\"#tab-1\">Ojectives</a></ li> <li class=\"e_risks_tab ui-tabs-selected\"><a href= \"#tab-2\">Risks</a></li> <li class=\"e_example_tab\"><a href=\"#tab-3\">Examples</a></li> </ul>\n"; // First Tab -> Description echo "<div id=\"tab-1\">\n"; ... etc The other classes in the <li> are for styling the tabs. Hope someone can help with this. From what I see this should have worked.