How can I change a CSS class of an HTML element in response to a changing page using PHP?
I already got the solution exactly like in this but this solution is for Javascript.
Basically, I want to add additional class when a certain IF condition is met. This is my code.
<li <?php if ($selected == "profile") echo 'class="active"'; ?> class="dropdown">
<a href="">Profile</a>
</li>
From my code, you can see that the <li>
already got a class in it. So, when I echo
another class in IF
condition, it completely change to the class in IF
condition.
What I need is an extra class, not different class. How can I do that?