i have a code like this:
if ($(this).css("background-color")==="rgb(217, 217, 217)") {
$(this).css("background-color", "#999");
}else{
$(this).css("background-color", "#fff");
}
but the bg color rgb(217,217,217) is a hover BG color change effect...
when I change the bg color of my div ..... ---> jquery is adding a "style=" ... " attribute to my DIV,
but after that my css hover code doesnt work no more because the "style" attribute is blocking my "class" attribute...
So how can i change with jquery CSS class attributes without adding a style="" attribute directly into my DIV?
THanks for any help
this is my fiddle demo
https://jsfiddle.net/qcvcga8k/24/
please click at the name "Manuel Neuer" (1st in the list) and after the BG changed to grey, click again on the name.... the BG is changing again to white, BUT the hover effect is missing...
i would be so happy, if you have any hints for me ;)
Thx
Alex
$(this).addClass('myClass');instead of doing it with.css(...)$(this).attr('class', 'greyRow');is inefficient use of jQuery, which has dedicated methods to manage class values.