Really simple question. I have the following code, and would like to consolidate it down as much as possible. Can\'t get it to work though.. tried using commas etc. Is there
No, but since you're using jQuery anyway, you can use that. This will add the statusBox
class to the elements with the IDs statusBox25
, statusBox75
, and statusBox100
:
$("#statusBox25, #statusBox75, #statusBox100").addClass('statusBox');
Alternatively, if you want to remove all of the existing classes and replace them all with statusBox
like your original code as doing, you could use this:
$("#statusBox25, #statusBox75, #statusBox100").attr('class', 'statusBox');