How to emulate pseudo classes with jquery?
This following code works on <li>'s when hovering the mouse over them.
$(".user-info-right-button").hover(
function () {
$(this).addClass('user-info-right-button-hover');
},
function () {
$(this).removeClass().addClass('user-info-right-button');
}
);
But what do I do if I want to change i.e. the background-color when it
is activated while deactivating the background-color from its sibling
<li>'s?
I tried this code but of course it does not work.
$(".user-info-right-button").click(function(){
$(this).addClass('user-info-right-button-active');
},
function () {
$(this).siblings().removeClass('user-info-right-button-
active');
}
Does anybody have an idea? Thank you!!
);