0

The following code doesn't apply to the CSS classes with :hover, but does with everything else. Anyway to make it work with CSS classes that have :hover, or any pseudo-classes for the matter?

$('.nav-sidebar, .nav-sidebar:hover').css("border-color", "blue");
Veloncia
  • 117
  • 3
  • 13

2 Answers2

1

Why not doing this?

$('.nav-sidebar > .active, .nav>li').hover(function(){
   $(this).css("border-color", "blue");
});
Dhaval Marthak
  • 17,246
  • 6
  • 46
  • 68
0

you can not use :hover selector in jquery like we do in css pseudo-classes selector.

In Jquery you can bind hover event using .hover()

Try this:

$('.nav-sidebar').css("border-color", "blue");
$('.nav-sidebar').hover(function(){
   $(this).css("border-color", "blue");
});
Ishan Jain
  • 8,063
  • 9
  • 48
  • 75