If You have multiple elements and do You want to set an active class only the clicked item. You can control with this snippet for instance a size selector on a webshop’s product page.
If You have only one element and do You want to control a menu dropdown toggle:
Method 1
HTML
Leave a Reply