Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7535299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:16:21+00:00 2026-05-30T06:16:21+00:00

After running this: $(‘.bar’).css({‘color’:’#fff’}); hover for .bar stops working. Why? Also, $(‘.bar:hover’).css({‘color’:’#fff’}); doesn’t change

  • 0

After running this: $('.bar').css({'color':'#fff'}); hover for .bar stops working. Why?

Also, $('.bar:hover').css({'color':'#fff'}); doesn’t change hover’s color too, why? What am I missing?

http://jsfiddle.net/hh4NJ/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:16:22+00:00Added an answer on May 30, 2026 at 6:16 am

    You haven’t defined what you mean by “hover”, but if you’re talking about CSS :hover, then it’s because inline styles (as set by .css() override stylesheet styles.

    You can add !important to your CSS definition to override the inline.

    .bar:hover {
        color: #ABCDEF !important;
    }
    

    I don’t believe this works with older IE though.

    DEMO: http://jsfiddle.net/hh4NJ/1/


    Another (and arguably better) solution would be to use .addClass() instead of .css() to change the style. Then you can take care of all of it in your CSS (except for adding/removing the class of course).

    $('.bar').addClass('whiteColor');
    

    .whiteColor {
        color:#fff;
    }
    

    DEMO: http://jsfiddle.net/hh4NJ/2/


    Regarding your update, you can’t use pseudo selectors like :hover for DOM selection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Similar to this question , after running the following code the browser dialog does
My cron job is running an hour later after end of DST. This didn't
Im beginning to learn sphinx search php api after running this query <?php include('sphinxapi.php');
Could somebody tell me why I'm getting blank rows after running this code? ...
Well I found this code , after running this I got some activity (as
I have Enterprise Application with EJB3 and JSF on Glassfish server. After running this
After running this code I find no entrys in my database. I receive no
I'm getting an MDA after running this code for the second time in a
After running the code below I get this output: Eve 1200 Could anyone explain
I get this heap corruption detected message after running this code : uli& uli::operator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.