There is a navigation block:
<ul class="nav navbar-nav"> <li> <a class="text-mutten" href="/link1">Пункт 1</a> </li> <li class='test other-cls'> <a href="/link2">Пункт 2</a> </li> <li> <a href="/link3">Пункт 3</a> </li> <li class=""> <a class="text-mutten active" href="/link4">Пункт 4</a> </li> </ul> And given the defining parameter insertion by href . for example, param = 'link2'
The regular expression should see in which href there is an occurrence of 'link2'. And where it was found, add the class "active" to the "LI" of the parent.
those. in our example, li class = 'test other-cls' will turn into class = 'test other-cls active'
How gracefully to implement it?