Tyler DeWitt
Tyler DeWitt

Reputation: 23576

jQuery UI Accordion in Accordion

Is it possible to have an accordion embedded in another accordion with jQuery UI?

-Item One
-Item Two
-Item Three
  --Sub One
  --Sub Two
  --Sub Three
-Item Four

Where Sub One through Four is another accordion.

Thanks

Upvotes: 10

Views: 18540

Answers (2)

Pbk1303
Pbk1303

Reputation: 3802

Just give different id names for each accordion and call them in the jquery function an you would have to edit the css to get the desired look though.

$(function() {
    $( "#accordion,#accordion2" ).accordion();
  });

DEMO

Upvotes: 1

Naveed Ahmad
Naveed Ahmad

Reputation: 3175

Give each container that you want to make an accordion a class like accordion and use:

$(".accordion").accordion();

Upvotes: 1

Related Questions