jQuery, multiple tab groups on one page

ClosDesign picture ClosDesign · Dec 16, 2010 · Viewed 8.7k times · Source

I am using a nice simple tab example from Soh Tanaka.http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery

I am trying to put multiple tab groups on the same page yet use the same classes for each tab group. I am making the content for the tabs dynamically, so making new classes for each tab group is out of the question.

How do I use the same classes, same jQuery for the different tab groups? I know there is the .each() method available in jQuery, but I am having trouble trying to figure out the correct places to put it in the jQuery. Any help is greatly appreciated.

Thanks in advance.

Answer

jyoseph picture jyoseph · Dec 16, 2010

In the comments on the blog entry you linked, there is a discussion about that. He links to a demo here: http://www.sohtanaka.com/web-design/examples/tabs/index3.htm

In that demo, there is a change in the way tabs are accessed.

$("div[class^='simpleTabs']").simpleTabs(); //Run function on any div with class name of "Simple Tabs"

This is done by wrapping your tabbed sections in a div with a class of simpleTabs