Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove/unbind hover on anchors

Tags:

jquery

unbind

html

<a href="home.html">Home</a>

css

a {
   color: blue;
}
a:hover {
   color: red;
}

now as you can see <a> now would be color red on hover.

Question
How do I remove hover via jQuery?
I have tried: $('a').unbind('hover'); and $('a').unbind('mouseenter mouseleave')

I come to think why it won't work, is this not hover()?

like image 274
Reigel Avatar asked Apr 22 '10 06:04

Reigel


1 Answers

Since a:hover is not bound event on the anchor tag and is only a pseudo class you won't have success unbinding the .hover() event.

If you want to change the behavior then you can do two things

  1. remove the a:hover styles

  2. bind a hover event on the anchor tag and set the css accordingly.

like image 134
rahul Avatar answered Nov 15 '22 00:11

rahul