title: Javascript toggle with Bootstrap collapse plugin
body: <p>I try to use the toggle function of the Bootstrap collapse plugin programmatically.
  I manage to toggle a div when I click on the link in accordion-heading but it works only once, that is to say I cannot click again to hide the div.</p>
  
  <p>Here is my code :</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="accordion" class="accordion"&gt;
      &lt;div class="accordion-group"&gt;
          &lt;div class="accordion-heading"&gt;
              &lt;a id="program${bean.id}" data-parent="#accordion" 
                     class="accordion-toggle"&gt;
              ...
              &lt;/a&gt;
          &lt;/div&gt;
          &lt;div id="collapse${bean.id}" class="accordion-body collapse"&gt;
              &lt;div class="accordion-inner"&gt;
              ...
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And later in the JSP :</p>
  
  <pre class="lang-js prettyprint-override"><code>$.each($('#accordion a.accordion-toggle'), function(i, link){
      $(link).on('click', 
          function(){
              // ...
              $('#collapse' + id_of_a_bean).collapse({
                  toggle : true,
                  parent : '#accordion'
              });
              // ...
          }
      )
  });
  </code></pre>
  
  <p>Did I miss something?</p>