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
$("#set50").live("click", function() {
$("statusBox50").addClass("statusBoxSelected");
$("statusBox25").addClass"statusBox");
$("statusBox75").addClass( "statusBox");
$("statusBox100").addClass( "statusBox");
$(".statusbar").animate({
width: '115px'
}, 500);
});
is this what u want ?
.addClass
adds a class to the selected element.[docs]
EDIT:
As u said u want a single.
Just assign a class to all the elements u want to add the class. For eg: i assign the class adding
. then u can addclass to all the elements like this :
$('.adding').addClass('statusBox')