How can I make the jquery UI accordion start collapsed when the form loads. Is there any javascript code for this?
To create an accordion that is collapsed by default, we need to set the 'active' property of the jQuery Accordion as false. Syntax: $("#demoAccordion"). accordion({ collapsible: true, active: false});
$('#accordion'). activate('activate',117);
Your append string needs to be terminated with single quotes since you are using double quotes with it. Also you need to include Jquery library. If you are using the jquery accordion you also need to include the Jquery UI library. Also your html is a bit off, here is a working example.
In your options specify:
{ ... active: false, collapsible: true, ... }
See documentation for active.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With