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

  • Home
  • SEARCH
  • 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 7845363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:11:56+00:00 2026-06-02T17:11:56+00:00

I have a set of divs. They need to be olive when i hover

  • 0

I have a set of divs. They need to be olive when i hover and they need to stay red when clicked (They need to go back to white when red divs are clicked). I need to make the divs “selected” (introduce a new class called selected) when they are clicked.

The problem is that everything works fine but when i hover on a div just after it gets clicked, the hover still seems to have effect. Here’s my code

$(document).ready(function () {

    $("div.onemovie").not("select").hover(
  function () {
          $(this).css("background-color", "Olive");

  },
  function () {
          $(this).css("background-color", "White");
      }

  );
});

Click Code:

 $(document).ready(function () {
  $("div.onemovie").toggle(
  function () {
      $(this).toggleClass("select");
      $(this).css("background-color", "Red");
  },

  function () {
      $(this).toggleClass("select");
      $(this).css("background-color", "White");
  }
  );

});

Here’s a JS Fiddle link of my situation: http://jsfiddle.net/mNsfL/

  • 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-06-02T17:11:58+00:00Added an answer on June 2, 2026 at 5:11 pm

    Does this version do what you want?

    http://jsfiddle.net/X7HbY/7/

    I think you can accomplish what you want much more simply by using CSS for the hover effect.

    Also, you shouldn’t have to set the background color back to white. When the rule no longer applies, the div will revert to its former settings.

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

Sidebar

Related Questions

I currently have a set of divs (buttons) that all hover various colors using
Doing some jquery animation. I have certain divs set up with an attribute of
I have the following function set up to sequentially fade in divs (with class
I have a series of floating divs without set height arranged so that three
Hello i have set of elements. They have several classes on one element. <div
i have 2 overlapping divs like so: div.back { background:url(brick.png); background-attachment:fixed; background-position:right top; background-repeat:no-repeat;
I have a set of divs that represent story categories. In each category, there's
Two questions... I have a set of DIVS with some code intended to change
I have a layout with a set of divs each containing three fields in
I have a load of divs that area ll floated left so they sit

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.