afficher masquer background-color
Bonjour,
j'ai une fonction qui affiche un div suite à un clic sur un lien.
le problème c'est que lorsque je clique à nouveau sur le lien le style "coloriserCmd" ne se supprime pas.
merci pour votre aide
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
.coloriserCmd {
display: block;
background-color: #EBEBEB;
}
.nocoloriserCmd {
display: none;
background-color: #FFFFFF;
}
function afficher_liste(){
$("a.rubrique").click(function(){
var rubrique = $(this).attr("rel");
$("#"+rubrique).toggle();
if($(this).hasClass("coloriserCmd") == false){
$(".tb"+rubrique).addClass("coloriserCmd");
}else{
$(".tb"+rubrique).addClass("nocoloriserCmd");
}
return false;
});
} |