how to dynamically set the active class in bootstrap navbar?
<p>I am using bootstrap nav bar with codeigniter as backend.</p>

<p>Now In my application i want to change the &lt; li> class to active dynamically for each page.</p>

<p>So i can known i am on which page currently.</p>

<p>Below is my code:</p>

<pre><code>&lt;ul class="nav navbar-nav"&gt;
      &lt;li class="active"&gt;&lt;a href="&lt;?php echo site_url('admin/dashboard'); ?&gt;"&gt;Dashboard&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="&lt;?php echo site_url('admin/company');?&gt;"&gt;Company&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="&lt;?php echo site_url('admin/user');?&gt;"&gt;Users Management&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="&lt;?php echo site_url('admin/key');?&gt;"&gt;Key Management&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="&lt;?php echo site_url('admin/activation');?&gt;"&gt;Activated Devices&lt;/a&gt;&lt;/li&gt;

  &lt;/ul&gt;
 &lt;ul class="nav navbar-nav navbar-right"&gt;
</code></pre>