I have three unique ID's like so:
#green-text {
color: #57BF90;
}
#grey-text {
color: #474444;
}
#orange-text {
color: #FFAC00;
}
Which each has a class called .example-button
. When one of these classes is clicked, I'd like to use jQuery to do
$('.example-button').click(function() {
$(this).addClass('white-text');
$(this).siblings().removeClass('white-text');
}
where
.white-text {
color: white;
}
But of course this class doesn't take priority over the ID's so nothing would change. Is there a better way to script this other than
.white-up-text#green-text {
color: white;
}
.white-up-text#grey-text {
color: white;
}
.white-up-text#orange-text {
color: white;
}
or other than using !important
? (I'm avoiding !important
in order to respect good CSS practice)