JSFiddle - React, Tailwind, and code Playground

by 3rror404

HTML

<ol>
   <li>Element 1</li>
   <li>Element 2</li>
   <li>Element 3
      <ol>
         <li>Element 3.1</li>
         <li>Elenent 3.2
            <ol>
               <li>Element 3.2.1</li>
               <li>Element 3.2.2</li>
            </ol>
         </li>
      </ol>
   </li>
</ol>

CSS

.my_li_background{background: #ddd}

JavaScript

$('li').click(function(e){
	e.stopPropagation();
  $('.my_li_background').removeClass('my_li_background');
  $(this).toggleClass('my_li_background'); //Alternate background on click
});