I assign a class to the element, but after loading the page, the class is deleted.
I use this function in my script.js
$('#main-nav li ul li a').click(function(){ $('#main-nav li ul li').children().removeClass('current'); $(this).addClass('current'); });
and this is in my view of PHP:
<ul id="main-nav"> <li> <a href="#" class="nav-top-item no-submenu"> On site </a> </li> <li> <a href="#" class="nav-top-item current"> Programs </a> <ul> <li><a href="<?php echo site_url('admin/country_management')?>">Manage country</a></li> <li><a href="<?php echo site_url('admin/channel_management')?>">Manage channel</a></li> <li><a href="#">Manage Comments</a></li> <li><a href="#">Manage Categories</a></li> </ul> </li> </ul>
If I use this <li><a href="<?php echo site_url('...')?>">Manage</a></li> , the class current is added, but after removing the load.
How can I add a class if I use php code after the download page or do you have any solution?
source share