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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:12:07+00:00 2026-06-08T14:12:07+00:00

I currently have a total of 4 boxes with the same class and each

  • 0

I currently have a total of 4 boxes with the same class and each has its own ID, when any of the boxes are clicked, the background colors of all the boxes should change to that of an assigned div ID.

I do want to have it be a specific color as in the current JS fiddle example, I want it to be what ever color a particular div is.
i.e. #box2 will change color on .click to that of #box1 and #box1 will change to the color of #box4. thus giving the illusion of the boxes moving clockwise. I want this to be usable for an unlimited number of clicks.

        $(document).ready(function () {
            $('.colorbox').click(function () {
                $('#box1').css('background-color', 'blue');
                $('#box2').css('background-color', 'red');
                $('#box3').css('background-color', 'yellow');
                $('#box4').css('background-color', 'green');           
            });
        });

See http://jsfiddle.net/YMqyE/

  • 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-08T14:12:09+00:00Added an answer on June 8, 2026 at 2:12 pm

    Like this? http://jsfiddle.net/YMqyE/2/

    $(document).ready(function () {
            $('.colorbox').click(function () {
                var $b1 = $('#box1'),
                    $b2 = $('#box2'),
                    $b3 = $('#box3'),
                    $b4 = $('#box4'),
                    box4Color = $b4.css('background-color');
                $b4.css('background-color', $b3.css('background-color'));
                $b3.css('background-color', $b2.css('background-color'));
                $b2.css('background-color', $b1.css('background-color'));
                $b1.css('background-color', box4Color);
    
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have total 70,000 records in database. currently i displays all the records in
I currently have a CSV file which, when opened in Excel, has a total
I currently have pagination functionality that displays the total page count, but I was
I currently have a query that looks like this: SELECT NON EMPTY ([Measures].[TOTAL]) ON
I currently have 4 tables. Product, Category, SubCategory, ProductSubCategory. Category has a OneToMany SubCategory
We currently have an application that is roughly 22 megs total. Our current deployment
I currently have a structure that is a dict: each value is a list
I have total of 9 Edit text boxes now i have implemented on focuschangelistener
I want to implement simple paging. I currently have a Dictionary and display its
Currently have a drop down menu that is activated on a hover (from display:none

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.