title: Calling "collapse" on bootstrap accordion in a modal prevents me from opening it again
body: <p>I'm using bootstrap/jquery. I have a modal window with a form in it, and the form contains an accordion group. I'd like to collapse everything in the accordion group each time the modal is opened. I've added the following code that executes when I click the button to open the modal:</p>
  
  <pre><code>$('.accordion-body').each(function(){
      if ($(this).hasClass('in')) {
          $(this).collapse('toggle');
      }
  });
  </code></pre>
  
  <p>It works to collapse everything in the accordion group, but every accordion that has the collapse toggle called won't expand when clicked anymore. I get similar behavior replacing the code above with this:</p>
  
  <pre><code>$('.accordion-body').collapse();
  </code></pre>
  
  <p>In this case, since the collapse gets called on all the accordion bodies, nothing will expand.</p>
  
  <p>Thanks in advance for any suggestions.</p>