Imagine a scenario where there are numerous items, each labeled with a specific class. There may be multiple items sharing the same class.
If a user clicks or drags an item, I want all other items with the same class to be highlighted as well.
I am looking for a more sophisticated approach rather than simply using JavaScript to loop through all items and apply the "highlighted" class to matching items.
Is there a way to achieve this without needing to manually define or generate CSS for each class?