The code snippet is inspired by Ben MacGowan CodePen, but modificated to prevent possible issues.
Mostly, in my example, I pass “active” class to the parent HTML “li” tag, not directly to “a”.
And, what might be very important, HTML “li” can have other classes, it is not limited.
Tabs Example
How do you use tabs effect in JavaScript?