In general, there is a small navigation from several links which I closed using e.preventDefault() . Link paths are category names. Below is a large block with a set of li elements that have an attribute class= {название категории к которой он относится} . Is it possible to make it so that when clicking on a link, its href is compared with the classes of li elements and those elements whose attributes do not match hide in display:none ? Or there is an easier algorithm to implement such an action.
<a href="#cat1">ссылка</a> <a href="#cat2">ссылка</a> <a href="#cat3">ссылка</a> <ul> <li class="cat1"></li> <li class="cat1"></li> <li class="cat2"></li> <li class="cat2"></li> <li class="cat3"></li> <li class="cat3"></li> </ul>
<li class="cat1 cat-for-li"></li>? - Grundy