0

I am using this code:

<script>
    $(document).ready(function() {
        $("#accordion").accordion(
            active: false,
            collapsible: true            
         });
</script>

But the accordion is broken and all panels are open.

How can I code it so the accordion panels area all closed.

Thanks to those who can help me.

2
  • 5
    Show us your HTML as well please.
    – Lowkase
    Jul 9, 2012 at 14:43
  • 1
    You may find it very helpful to format your code more consistently. If you indent every time you have { and outdent for any }, you can quickly track if a block of code has the same number of open and close brackets. Formatting is good for general readability too. Anyone else who needs to read your code will thank you. Jul 9, 2012 at 14:48

5 Answers 5

2

It looks like you are missing several braces and parenthesis. Try this:

<script>
    $(document).ready(function() { 
        $("#accordion").accordion({ // <- add this curly brace {
            active: false, 
            collapsible: true
        });
    }); // <- add these to close the ready function
</script>

P.S. I'm sure a javascript error was raised for this. To see these errors, open up your javascript console. In Chrome, hit F12 and click on Console. In Firefox, install firebug and then hit F12. In IE, well, don't debug there. (I'm half kidding; IE has a debugger that you can use if you want.)

1

You have a few typos in your question code. This should work:

$(document).ready(function() {
    $("#accordion").accordion({
        active: false,
        collapsible: true
    });
});​
0

Did you missed the {?

$("#accordion").accordion({
    active: false,
    collapsible: true            
});
0

Try this setting

alwaysOpen: false

oh and you got some missing braces there

$(document).ready(function() {
  $("#accordion").accordion({
   active: false,
   collapsible: true,
   alwaysOpen: false
  });
});
0
$(document).ready(function () {
  $("#accordion").accordion({
    active:false,
    collapsible:true
  }); 
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.