title: Bootstrap navbar collapse - how to close by clicking away
body: <p>I guess this is a noob question. I want Bootstrap "navbar-collapse" to close by clicking away or by clicking one of list items. I found this code somewhere and it works.</p>
  
  <pre><code>$(document).on('click',function() {
      $('.collapse').collapse('hide');
  });
  </code></pre>
  
  <p>But this code also makes Bootstrap "panel-collapse" elements close by clicking away and of course I don't want this to happen.</p>
  
  <p>How can I specify that I want this code to work only for "navbar-collapse" elements?</p>