Updated JQuery Nested Tab Set with Demo
Ok, there have been some changes, but I'll try to keep it easy, with an example, and there will be an included .zip file. First, you'll need the latest JQuery build, as well as the latest version of the Tabs Plugin. Pay attention to the pathing I have created in my code snippets here.
Include the necessary JavaScript libraries and CSS files:
<script src="http://www.myserver.com/js/jquery/plugins/tabs/jquery.tabs.pack.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://www.myserver.com/resources/css/tabs/jquery.tabs.css" type="text/css" media="print, projection, screen">
<!-- Additional IE/Win specific style sheet (Conditional Comments) -->
<!--[if lte IE 7]>
<link rel="stylesheet" href="http://www.myserver.com/resources/css/tabs/jquery.tabs-ie.css" type="text/css" media="projection, screen">
<![endif]-->
<script src="http://www.myserver.com/js/custom/jqTabsExample.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://www.myserver.com/resources/css/custom/jqTabsExample.css" type="text/css">
Next, layout your content. You'll notice that container elements have changed slightly from before.
<ul>
<li><a href="#half-frag"><span>Form 1</span></a></li>
<li><a href="#fragment-1"><span>One</span></a></li>
<li><a href="#fragment-2"><span>Two</span></a></li>
<li><a href="#fragment-3"><span>Tabs are flexible again</span></a></li>
</ul>
<div id="half-frag">
<form name="section-1" id="section-1" action="process.cfm" method="post" enctype="multipart/form-data">
<ul class="anchors">
<li><a href="#form1_step1"><span>Step 1</span></a></li>
<li><a href="#form1_step2"><span>Step 2</span></a></li>
<li><a href="#form1_step3"><span>Step 3</span></a></li>
</ul>
<div id="form1_step1" class="frmStep">
Field 1: <input type="text" name="field1" id="field1" />
</div>
<div id="form1_step2" class="frmStep">
Field 2: <input type="text" name="field2" id="field2" />
</div>
<div id="form1_step3" class="frmStep">
Field 3: <input type="text" name="field3" id="field3" /><br />
<input type="submit" name="submit" id="submit" value="Post Form" />
</div>
</form>
</div>
<div id="fragment-1">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-2">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
<div id="fragment-3">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
</div>
</div>
Your end result should look a little like this:
The files (minus the js libraries) should be included in the Download below. Next time out I'll do the same with JQuery and the ExtJS UI Library.


I haven't fully tested, but the nesting looks perfect, assuming this isn't a single instance of nest that is too ID dependent. Will I be able to create a 2nd nest on the same page?
Konqueror/Ubuntu fails completely. For a browser that is supposed to be so standards compliant, it only fails 90% of the time. Still, the problem is probably not great. The failure seems total, so it's probably just some detect issue?
BTW, Klaus is a great help, and is quick to answer questions regarding the plugin.
Tabs Plugin conflicts with IE and smartmenus, but not FF. sure would be nice to have a workarund.
BTW, i visit nashville to visit family from time to time.
.
We had very similar issues with using swfobject and JQuery. Basically, swfobject would programatically break IEs DOM when it rendered a Flash movie. This took quite a bit to discover, and even more to replace swfobject within our code. Chance are that you are running into a very similar issue.
thanks
thank u for gr8 post, but do there any way to mix or duplicate form1 again ? for ex. to be form1 & form2 & one and two tabs ? i try but i failed :(
How can one move the <form> tag?
Also, the <ul> must be inside a <form> tag of they dont render right either.
-Jason
Yeah, I put this tutorial out back in June of last year, and JQuery has already changed significantly, so this example may no longer apply. While I love JQuery for basic DOM manipulation, I've found ExtJS's component library to be much more comprehensive and consistent, so I haven't modified these older tutorials to use the latest versions of the JQuery library.
Well, that may be because you're using PHP;) If you want to post your (JQuery) code I can try to help you figure it out. Also, the JQuery group on Google Groups is an extremely active list.
I am not sure if you are aware. The tutorial on JQuery Nested Tab Set
with Demo is quite educative. I am in the process of downloading the
demo so to view but some of the folders are blank. I wondering if there is anyway you could provide the complete download in those
folders.
Thanks you.
George
The above is working fine for me. You can click on the tabs, etc. This example was also written a year and a half ago, and JQuery (and different plugins) has changed quite a bit, so I have no idea if this would work with 1.3.
http://www.stilbuero.de/jquery/tabs_3/nested.html
Till now i was trying to iniitialise the two tabs individually and the nested div was not at all correctly shown inside its container.
I had used $("#container").tabs() previously but in vain for nested divs. Changing that to $("#containder ul").tabs() solved the issue
Thank you, I might use this one for my further projects...
I am studying JQuery ..o(?_?)o... Thanks !
You are absolutely right, JQuery has changed a great deal since I wrote this. I'll also agree with you about ExtJs. There's a nested tab demo for Ext on this site too (also out of date).