Hi i am using the "selectable" of jQuery UI and i have multiple divs aligned vertically as a list and upon selecting each div the div's background changes to PINK and when i select another DIV the one selected previously should change to WHITE background. As of now i achieved what i need but the problem is the EACH function. if i have 100 divs, it loops for 100 times and checks the below conditions. My question is how can i avoid this looping and make unique selection (i.e., No two DIVs should have same color).
$(".selectDiv").click(function(){
var clkLink = this.id;
$(".selectDiv").each(function(){
var clkLink2 = this.id;
if(clkLink != clkLink2)
$(clkLink2).css("background","#FF00CC");
else
$(clkLink2).css("background","#FFFFFF");
});
});