JSFiddle - React, Tailwind, and code Playground

HTML

<ul><li class="maincat"><a title="" href="">Animals</a> (2)</li>    <li class="cat-item"><a title="View all posts filed under Birds" href="">Birds</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Cats" href="">Cats</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Dogs" href="">Dogs</a>
</li>
    <li class="cat-item cat-item-74"><a title="View all posts filed under Exotic pets" href="http://www.ingemit.com/puntdeal/ad-category/animals/exoticpets/">Exotic pets</a>
</li>
    <li class="cat-item cat-item-73"><a title="View all posts filed under Fish" href="http://www.ingemit.com/puntdeal/ad-category/animals/fish/">Fish</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Horses" href="">Horses</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Others" href="">Others</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Pet Accessories" href="">Pet Accessories</a>
</li>
</ul>
<ul><li class="maincat"><a title="" href="">Cars</a> (2)</li>    <li class="cat-item"><a title="View all posts filed under Birds" href="">Ford</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Cats" href="">Nissan</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Dogs" href="">Porche</a>
</li>
    <li class="cat-item cat-item-74"><a title="View all posts filed under Exotic pets" href="http://www.ingemit.com/puntdeal/ad-category/animals/exoticpets/">Exotic pets</a>
</li>
    <li class="cat-item cat-item-73"><a title="View all posts filed under Fish" href="http://www.ingemit.com/puntdeal/ad-category/animals/fish/">Fish</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Horses" href="">Mazda</a>
</li>
    <li class="cat-item"><a title="View all posts filed under Others" href="">Others</a>
</li>
    
</ul>

CSS

li.cat-item {
  background: url("images/bullet-grey.png") no-repeat scroll 4px 11px transparent;
  border-bottom: 1px solid #EFEFEF;
  display: none;
  line-height: 20px;
  padding: 5px 0 5px 12px;
}

JavaScript

$('ul').on('click','.maincat',
           function(e){
               e.preventDefault();
               $(this).hide();
               
               $(this).closest('ul').siblings('ul').find('.maincat').siblings('li:visible').hide();
           });