php - how to load the default active class with href, while loading the page -


<ul class="nav nav-pills nav-stacked project-body" style="background-color: white">             <?php foreach($get_policies $policies) : ?>                 <li role="presentation" class="<?php echo $policies['policies_id'] == $policies_id ? "active" : "" ?>"><a href="<?php echo base_url().'policies/index/'.$policies['policies_id'] ?>"><?php echo $policies['policies_title'] ?></a>                 </li>             <?php endforeach; ?>         </ul> 

i have above code snippet, can display policies in vertically. want first policies should loaded while loading page. make class active default policies loaded.

you can use nth-child doing this

$('.project-body li:first-child').addclass('active'); 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -