tags:

views:

874

answers:

3

Here is the full sample script which demonstrates the problem, inner tabs company/department come up as list instead of tabs

Edit: i have already tried what People have suggested that inner tabs should also be tabified via jquery but

Code:

<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"&gt;&lt;/script&gt;
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"&gt;&lt;/script&gt;
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"&gt;&lt;/script&gt;
<script type="text/javascript">
$(function(){
    //make tabs tabs
    $('#top-tabs').tabs({selected: 2});
});
</script>

</head><body>

<div id="top-tabs">
   <ul>
             <li><a href="/timeapp/home">Home</a></li>
             <li><a href="/timeapp/timecard">Timecard</a></li>
             <li><a href="#tab-selected">Config</a></li>
   </ul>

   <div id="tab-selected">
    <ul>
              <li><a href="#inner-tab-selected">Company</a></li>
              <li><a href="/timeapp/config/department">Department</a></li>
    </ul>
    <div id="inner-tab-selected">ok this is a company</div>

   </div>
</div>

</body></html>
+1  A: 

If this is your entire File, then the problem is, your not telling it that the "tab-selected" div is supposed to be tabs. I haven't tested it but adding a :

 $('#tab-selected').tabs();

would probably do the trick.

Patricia
+1 you were nearer, but not exact.
Anurag Uniyal
A: 

It seems it doesn't work - I've tried and I am still looking how to fix it. If you want to load an Ajax tab that is not the "first one" - seems that it doesn't work.

The first tab loads easily though!

Trying it
A: 

I posted the question at jquery forum and got the answer http://www.jqueryhelp.com/viewtopic.php?p=10956#10956

reason is elem.tabs() should be called on all inner tabs the exampel i gave does it by using jquery selector e.g. $('#container ul').tabs();

so here is the modified working script

<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"&gt;&lt;/script&gt;
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"&gt;&lt;/script&gt;
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"&gt;&lt;/script&gt;
<script type="text/javascript">
$(function(){
    //make tabs tabs
    $('#top-tabs').tabs({selected: 2});
    $('#low-tabs').tabs({selected: 1});
});
</script>

</head><body>

<div id="top-tabs">
   <ul>
             <li><a href="/timeapp/home">Home</a></li>
             <li><a href="/timeapp/timecard">Timecard</a></li>
             <li><a href="#tab-selected">Config</a></li>
   </ul>

   <div id="tab-selected">
    <div id="low-tabs"> 
    <ul>
              <li><a href="#inner-tab-selected">Company</a></li>
              <li><a href="/timeapp/config/department">Department</a></li>
    </ul>
    <div id="inner-tab-selected">ok this is a company</div>
     </div> 
   </div>
</div>

</body></html>
Anurag Uniyal