I understand that selecting by the class attribute in jquery is one of the most performant ways of selecting elements. We apply the class attribute on all elements to represent the CSS style. I’d like to select a subset of these elements using jquery class selector.
So, should I be applying multiple styles to the element – one to represent the css style and the other on solely for jquery selection purposes?
You can use multiple classes to describe different “information” of an element. For example WordPress does that with the “body” element, it assigns classes that represent the browser type etc.
Another way to do that is to assign a class / id to a parent of the elements you want to select, such that you can do this: