javascript toggle parent class code example
Example: how to toggle class of parent in javascript
/* HTML */
/*
<div class="tab-links closed">
<a class="tab-links__link" onclick="toggleLink(this)"></a>
<a class="tab-links__link" onclick="toggleLink(this)"></a>
<a class="tab-links__link" onclick="toggleLink(this)"></a>
<a class="tab-links__link" onclick="toggleLink(this)"></a>
</div>
*/
const toggleLink = (element) => {
element.parentNode.classList.toggle('closed');
}