Jquery how to add :hover to css style sheet


Tags: javascript,jquery,css

Problem :

This is the CSS I like to convert to jQuery code:

BUTTON:hover .buttonTextDIV {
background-color: #FFFFFF;
border-right: 4px solid #d1dbea;
border-bottom: 2px solid #d1dbea;}

I use a filter in 4.01 Transitional and I have a problem with the $().hover event where the effects of the filter are negated by the onmouseleave function which $().hover uses to "emulate" the css :hover option when it leaves the object.

So I need to "hardcode" button:hover .buttonTextDIV using jQuery.

I want to specifically add this to each element seperate using : $(".buttontext").each(function(){}

Is there a way to do this?

I don't want people telling me not to use 4.01, if you intend on doing that please move on to the next question.



Solution :

JavaScript cannot directly define or edit pseudo classes of CSS. Not unless you edit the CSS directly. But if hover() is not working for you (you didn't indicate why?), I can only suggest that you try manually defining your own events:

.mouseenter()
.mouseleave()

.mouseover()
.mouseout()


    CSS Howto..

    How to send HTML to an embedded WebView without running a local webserver?

    How to position a background image like wanderfly.com?

    how to add mutiple values to jquery code

    How simple CSS breadcrumbs work

    How do i add and remove an active class with jQuery?

    How to make image scale as per browser window?

    CSS: How to limit horizontal/vertical scrolling?

    How to prevent css auto hyphenation for email addresses

    How to align image to top left of div

    How do I go about dynamically splitting a body of text into two even columns with plain Javascript (no JQuery)?

    How would I get an img element to render under a background-image in CSS

    how to hide submenus in jquery menu

    Gulp Sass - How to properly name the output css?

    Hiding the content of a
    and showing another
    with different contents

    How can I get the seletced filename from file button?

    How to exclude some text from browser zoom

    How to send web page in email body with css

    How to show current page using CSS? .current_link not working

    How to change font size of the first option tag in a dropdown menu (select)?

    How to add formatting to my pagination

    How to make an image inside a diamond shape morph to circle

    How do I get the background image to not repeat and take up the entire section?

    How to get a 2 column widget area defined in CSS?

    How to override default Polymer CSS

    How to use CSS to style 4 blocks of Info in the homepage?

    how to change the cssclass of a div after press a button in asp.net c#?

    how to obtain proper alignment of tables on top of each other with horizontal scrollbar at bottom

    How to set a relative position/size to the screen for elements in CSS/HTML? [closed]

    How can I target only visible objects with nth-child?

    How to separate form with horizontal line