JQUERY UI Accordion start collapsed

How can I make the jquery UI accordion start collapsed when the form loads. Is there any javascript code for this?


Solution 1:

In your options specify:

{
  ...
  active: false,
  collapsible: true,
  ...
}

See documentation for active.

Solution 2:

I was trying to do the same thing. Using Jquery UI tabs. I wanted none to show with 5 tabs when you start.

using active: false showed the 5th tabs content. So I set tabs CSS to display:none; since it in-line changes display. Hope this helps someone!

<script>
$(function() {
    $( "#tabs" ).tabs({
        active: false,
        collapsible: true,
    });
});

And in the style

#tabs-1, #tabs-2, #tabs-3, #tabs-4, #tabs-5{ 
    display:none;
}