title: how to set active class to nav menu from bootstrap
body: <p>I'm new to the bootstrap. Using their navigation menus. I'm trying to set the active class to the selected menu. my menu is -</p>
  <pre><code>&lt;li class=&quot;nav-parent&quot;&gt;
      &lt;a class=&quot;nav-link&quot; href=&quot;#&quot;&gt;
          &lt;i class=&quot;fa fa-info&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
              &lt;span&gt;Information&lt;/span&gt;
      &lt;/a&gt;
      &lt;ul class=&quot;nav nav-children&quot;&gt;
          &lt;li&gt;
          &lt;a class=&quot;nav-link&quot; href=&quot;&lt;?php echo base_url('#');?&gt;&quot;&gt;
                                                      Terms &amp; Condition
          &lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
          &lt;a class=&quot;nav-link&quot; href=&quot;&lt;?php echo base_url('#');?&gt;&quot;&gt;
                                                      Privacy &amp; Policy
          &lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
          &lt;a class=&quot;nav-link&quot; href=&quot;&lt;?php echo base_url('#');?&gt;&quot;&gt;
                                                      About Us
          &lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  <p>I tried the following thing after googling on this that I have to set the active class on each page from the menu like as--</p>
  <pre><code>&lt;script&gt;
              $('li a').click(function(e) {
                      e.preventDefault();
                      $('li a').removeClass('active');
                      $(this).addClass('active');
                  });
  &lt;/script&gt;
  </code></pre>