title: programmatically hide Bootstrap accordion
body: <p>In my code I use a bootstrap accordion for extra option. When click start, I want to collapse (close) it. I tried </p>
  
  <pre><code>    $('#accordion2').collapse({
          hide: true
      });
  </code></pre>
  
  <p>But the accordion close and then reopen. A second click do not do anything more. What I miss here? As written in the Bootstrap documentation I use the data-parent to close it.
  The code is:</p>
  
  <pre><code>  &lt;div id="accordion2" style="width:802px;"&gt;
        &lt;div class="card"&gt;
          &lt;div class="card-header" id="headingImgOne"&gt;
            &lt;h5 class="mb-0"&gt;
              &lt;button class="btn btn-link" data-toggle="collapse" data-target="#collapseImgOne" aria-expanded="true" aria-controls="collapseImgOne"&gt;
                Testrun Optionen
              &lt;/button&gt;
            &lt;/h5&gt;
          &lt;/div&gt;
  
          &lt;div id="collapseImgOne" class="collapse" aria-labelledby="headingImgOne" data-parent="#accordion2"&gt;
            &lt;div class="card-body"&gt;
  
               &lt;div class="form-group row"&gt;
                 &lt;label for="text" class="col-4 col-form-label"&gt;Server&lt;/label&gt;
                 &lt;div class="col-7"&gt;
                   &lt;div class="input-group"&gt;
  
                                  &lt;div class="form-check"&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c06" id="c06" checked&gt; &lt;span class="label-text"&gt;c06&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c07" id="c07" checked&gt; &lt;span class="label-text"&gt;c07&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c08" id="c08" checked&gt; &lt;span class="label-text"&gt;c08&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c09" id="c09"&gt; &lt;span class="label-text"&gt;c09&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c10" id="c10"&gt; &lt;span class="label-text"&gt;c10&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c11" id="c11"&gt; &lt;span class="label-text"&gt;c11&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c12" id="c12"&gt; &lt;span class="label-text"&gt;c12&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c13" id="c13"&gt; &lt;span class="label-text"&gt;c13&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c14" id="c14"&gt; &lt;span class="label-text"&gt;c14&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c15" id="c15"&gt; &lt;span class="label-text"&gt;c15&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c16" id="c16"&gt; &lt;span class="label-text"&gt;c16&lt;/span&gt;
                                      &lt;/label&gt;
                                      &lt;label&gt;
                                          &lt;input type="checkbox" name="c17" id="c17"&gt; &lt;span class="label-text"&gt;c17&lt;/span&gt;
                                      &lt;/label&gt;
                                  &lt;/div&gt;
                   &lt;/div&gt;
                 &lt;/div&gt;
               &lt;/div&gt;
               &lt;div class="form-group row"&gt;
                 &lt;label for="select" class="col-4 col-form-label"&gt;Server Domain&lt;/label&gt;
                 &lt;div class="col-7"&gt;
                   &lt;select id="imgdomain" name="select" class="custom-select"&gt;
                        &lt;option value="domain.com" selected&gt;domain.com&lt;/option&gt;
                   &lt;/select&gt;
                 &lt;/div&gt;
               &lt;/div&gt;
  
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;br/&gt;
  </code></pre>