I have 2 different pages with common sidebar menu. In my example, you can see Parent Menus with Submenus. In Dashboard I've page1 sub-menu, when I click on it, redirects to other pages, I want in sidebar Parent menu should add a class. Even I refresh the page.
Here is my HTML code
Check this fiddle
<ul class="nav nav-sidebar">
<li class="sidebar-nav-item with-sub">
<a href="" class="sidebar-nav-link"><i class="icon ion-ios-home-outline"></i> Dashboard</a>
<ul class="nav sidebar-nav-sub">
<li class="nav-sub-item"><a href="menu1.html" class="nav-sub-link">Page 01</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Page 02</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Page 03</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Page 04</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Page 05</a></li>
</ul>
</li>
<li class="sidebar-nav-item with-sub">
<a href="" class="sidebar-nav-link"><i class="icon ion-ios-home-outline"></i> Menu</a>
<ul class="nav sidebar-nav-sub">
<li class="nav-sub-item"><a href="" class="nav-sub-link">Menu 01</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Menu 02</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Menu 03</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Menu 04</a></li>
<li class="nav-sub-item"><a href="" class="nav-sub-link">Menu 05</a></li>
</ul>
</li>
<li class="sidebar-nav-item with-sub">
<a href="" class="sidebar-nav-link"><i class="icon ion-ios-book-outline"></i> Pages</a>
<ul class="nav sidebar-nav-sub">
<li class="nav-sub-item sub-with-sub">
<a href="#" class="nav-sub-link">Pricing</a>
<ul>
<li class="sub-sub-link"><a href="">Pricing 01</a></li>
<li class="sub-sub-link"><a href="">Pricing 02</a></li>
<li class="sub-sub-link"><a href="">Pricing 03</a></li>
</ul>
</li>
</ul>
</li>
</ul>