keep a:active if clicked on any element

PHOTO EMBED

Thu May 19 2022 08:41:32 GMT+0000 (UTC)

Saved by @happy_cutman #react.js #html

function makeActive(a) {
    const items = document.querySelectorAll('.tab-active');
    if (items.length) items[0].className = null;
    a.className = 'tab-active';
  }

<a href="" className="tab-active" onClick={(e) => {makeActive(e.target)}}>Moulds</a>
<a href="" className='tab' onClick={(e) => {makeActive(e.target)}}>Fractionalization</a>
content_copyCOPY