Trigger css hover with JS [duplicate]

I know what you’re trying to do, but why not simply do this:

$('div').addClass('hover');

The class is already defined in your CSS…

As for you original question, this has been asked before and it is not possible unfortunately.
e.g. http://forum.jquery.com/topic/jquery-triggering-css-pseudo-selectors-like-hover

However, your desired functionality may be possible if your Stylesheet is defined in Javascript. see:
http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/

Hope this helps!

Leave a Comment