Add class to multiple cached jquery elements
jquery
Solution
You can use `add()` to add elements to a selector. Try this:
cachedElement1.add(cachedElement2).addClass('someclass');
API reference: Add()
Problem
With jQuery is it possible to add a class to multiple cached elements at the same time. I know i could do the following: ``` cachedElement1 = $('#div1'); cachedElement2 = $('#div2'); cachedElement1.addClass('someclass'); cachedElement2.addClass('someclass'); ``` But is there a short way of doing it. So something like the below which doesn't actually work. ``` $(cachedElement1,cachedElement2).addClass('someclass'); ``` Thanks