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 3873422
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:02:05+00:00 2026-05-19T22:02:05+00:00

fellow coders, just came across a strange (at least to me) behaviour for the

  • 0

fellow coders, just came across a strange (at least to me) behaviour for the .addClass method. I’m trying to highlight an item (div) when the mouse hovers over it by using the .addClass method and a .highlight class that changes the background-color of the div. (i’m using jQuery instead of the css :hover method for a reason.)

The code works meaning, the .highlight class is added to the div however the color is not changing. the color will only change when the div’s default css class does NOT have background-color defined in it. in other words, if the div is defined with a class that includes say background-color: white; the .highlight class is added but the color does not change.

Is this normal or am I missing something? for now, i’m using .css(‘background-color’, ….) to get the highlight going but i’m curious as to why the .addClass method is not working.

thanks.

  • 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-19T22:02:05+00:00Added an answer on May 19, 2026 at 10:02 pm

    Your original CSS class is overriding the new one.

    You can prevent this by adding !important to the hover rule, or by making its selector more specific, or by moving it after the original class in the CSS.

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

Sidebar

Related Questions

Greetings, fellow coders! I have this table that contains categories and subcategories (actually I
Hello fellow coders & codetts I was wondering, if I needed to create a
Hello , all my fellow coders! I've got a problem ohh chok! .. :P
Fellow coders, i have a function in a codeigniter controller that accepts a couple
Hello fellow coders. So i decided to rewrite some of my old scripts i
Hello fellow developers! I am trying to get the build error codes from a
Fellow Coders, so far I have been using the CI url helper to build
Fellow coders, I'm using an ADODB command to pull some information out of a
Fellow coders, i have a table that contains a number of rows each with
Fellow coders, I have asked this question before but did not get a conclusive

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.