title: Bootstrap 3 collapse panel programmatically
body: <p>i've got a question.
  Is there any way to collapse and switch back bootstrap panel programmatically. </p>
  
  <pre><code>&lt;div class="panel panel-default panel-primary"&gt;
      &lt;div class="panel-heading"&gt;
                  ...
          &lt;div class="pull-right"&gt;
              &lt;div class="btn-group"&gt;
                  &lt;button type="button" class="btn btn-info btn-xs" data-toggle="collapse" data-target="#to"&gt;
                      &lt;i class="fa fa-chevron-down fa-fw"&gt;&lt;/i&gt;
                  &lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div id="to" class="panel-body collapse"&gt;....&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I need to collapse it or expand with some handler.</p>