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");
1
  • I do not understand this question. Commented May 24, 2014 at 6:05

2 Answers 2

1

Why not doing this?

$('.nav-sidebar > .active, .nav>li').hover(function(){
   $(this).css("border-color", "blue");
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, this helped. Not sure why I didn't think of that. :D
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");
});

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.