jeudi 26 janvier 2017

come back to the default statement after selection?

i have 4 bottom(like box) and one click with is select each bottom and then each bottom should change its color. it is work for the first selection but after i select second bottom, the first box is still has its last color form last statement, how can i comeback to the default statement in each time of selection:

if (data4==a) {
  $(".button1").css('background-color', '#2EFE2E');
}else if(data4==b){
    $(".button2").css('background-color', '#088A08');
}else if(data4==c){
    $(".button3").css('background-color', '#088A08');
}else if(data4==d){
    $(".button4").css('background-color', '#088A08');
}else{
     $(".button1, .button2, .button3, .button4").css('background-color', 'black');
}

thanks for your help

Aucun commentaire:

Enregistrer un commentaire