JavaScript Open Navigation by default under Data-toggle=“collapse” bootstrap

I am new to bootstrap. I am making an sidebar accordion navigation using data-toggle="collapse" but it closes the navigation by default. what should i do to open navigation by default and it get close when i click on it.

HTML

<li class="parent "><a  target='_blank' href="#sub-item-3" data-toggle="collapse"><span  class="glyphicon glyphicon-list"></span> Summary<span data-toggle="collapse" target='_blank' href="#sub-item-3" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span></a>
    <ul class="children collapse" id="sub-item-3">
        <li><a class="" target='_blank' href="#"><span class="glyphicon glyphicon-share-alt"></span> Sub Item 1</a></li>
        <li><a class="" target='_blank' href="#"><span class="glyphicon glyphicon-share-alt"></span> Sub Item 2</a></li>
        <li><a class="" target='_blank' href="#"><span class="glyphicon glyphicon-share-alt"></span> Sub Item 3</a></li>
    </ul>
</li>

JS

!function ($) {
    $(document).on("click","ul.nav li.parent > a > span.icon", function(){          
        $(this).find('em:first').toggleClass("glyphicon-minus");      
    }); 
    $(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
}(window.jQuery);
Answer:1

I am wondering if it's possible to detect words input. I have 2 options: The word to be written in an input, and at Enter press to fire a certain command like animate or go to url. The word to be ...

I am wondering if it's possible to detect words input. I have 2 options: The word to be written in an input, and at Enter press to fire a certain command like animate or go to url. The word to be ...

I have a relatively simple regex problem - I need to match specific words in a string, if they are entire words or a prefix. With word boundaries, it would look something like this: \b(word1|word2|...

I have a relatively simple regex problem - I need to match specific words in a string, if they are entire words or a prefix. With word boundaries, it would look something like this: \b(word1|word2|...

  1. javascript regex simulator
  2. js regex simulator

Let me cut to the chase. It's on this site: http://www.smb.nu/wip/kampanj/ The white bar with the links is supposed to stick to the top when scrolled past, this effect is achieved with some simple ...

Let me cut to the chase. It's on this site: http://www.smb.nu/wip/kampanj/ The white bar with the links is supposed to stick to the top when scrolled past, this effect is achieved with some simple ...

Quick question. Why does the following give a this.testFunction is not a function error? Test = { data: true, testFunction: function() { this.data = true; }, initialize: ...

Quick question. Why does the following give a this.testFunction is not a function error? Test = { data: true, testFunction: function() { this.data = true; }, initialize: ...

  1. simple javascript object
  2. simple javascript object example
  3. create simple object javascript