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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:07:41+00:00 2026-06-16T01:07:41+00:00

I came across one problem. I’ve created some tabs functionality as can be seen

  • 0

I came across one problem.
I’ve created some “tabs” functionality as can be seen in demo: http://jsfiddle.net/4FLCe/

The plan was, when you hover over tab, its color changes to color A, when you click on tab, its color changes to color B.

As can be seen from demo, after click background color stopped changing on hover. I thought of adding !important to background color of hover, results can be seen: http://jsfiddle.net/4FLCe/1/

But that performed not as I wanted, hover now would work over background color set from javascript. Then I added !important to color set in javascript. That resulted in something terrible. The only browser that understood what I wanted to achieve was Opera.

Other browsers just stopped applying one from js. Demo: http://jsfiddle.net/4FLCe/2/

So the question is: how to achieve next – working hover, background of selected tab have higher ‘priority’ than hover so it won’t change to background of hover on hover, and same result in ie,safari, opera, chrome, ff?

  • 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-16T01:07:42+00:00Added an answer on June 16, 2026 at 1:07 am

    You should use a class instead of setting it through the .css() method..

    So create

    .selected-tab{
        background-color:#d6d6d6!important;
    }
    

    and change your code to

    $(function() {  
        $('.pagecontent').eq(0).show();
        $('.tab').click(function() {  
            $('.pagecontent').hide();
            $('.selected-tab').removeClass('selected-tab');
            $(this).addClass('selected-tab');
            $('.pagecontent').eq($(this).index()).show();
        });  
    });
    

    Demo at http://jsfiddle.net/gaby/4FLCe/3/

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

Sidebar

Related Questions

I recently came across Linsched where one can simulate in user-space some of the
i came across a problem on PLSQL and hope i can get here some
I came across this problem two or three times. One of my customer restored
I'm creating a setup project for WCF net-tcp service. One thing I came across
Im very new to SVNs and I came across one problem: how to set
I'm trying to learn Java, and came across a problem on one of the
I came across a problem today, and I'm wondering if I can fix it.
I'm doing some exercises and I came across a problem. I have got DLL
i'm working on extjs and came across one small problem it is , wen
I have been thinking of this problem for some time now,I came across this

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.