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

The Archive Base Latest Questions

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

So I am a junior c# developer, and at the moment I am currently

  • 0

So I am a junior c# developer, and at the moment I am currently writing up a new website for myself. I am currently trying to make it so that I am able to have a class on say, an anchor tag called “default”, then when you are to mouseenter() over the anchor, it will remove the class and then add the class of “hover”.

Then when you mouseleave(), the “hover” class is then removed, and the “default” class is then appended again.

And then I will also have a click() call to remove “default” or “hover”, to then append the class of “active”

I am having a bit of trouble with how to layout my .js document, it is quite a noobish question to ask really… But I am just not sure as to how I can write up a .js document, and have these multiple calls to different functions depending what is happening to the anchor element, all in the one document.

Any help is appreciated, cheers,
– Adam

  • 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-16T15:57:09+00:00Added an answer on June 16, 2026 at 3:57 pm

    To do this with jQuery:

    $('a.default').hover(
        function(){
            $(this).toggleClass('default hover');
        },
        function(){
            $(this).toggleClass('default hover');
        });
    

    JS Fiddle demo.

    Or you could use:

    $('a.default').hover(
        function(){
            $(this).removeClass('default').addClass('hover');
        },
        function(){
            $(this).removeClass('hover').addClass('default');
        });
    

    JS Fiddle demo.

    But, honestly, CSS would work just as well and be far more simple:

    a.default:link,
    a.default:visited {
        /* default styles */
    }
    
    a.default:hover,
    a.default:active {
        /* hovered styles */
    }
    

    JS Fiddle demo.

    References:

    • addClass().
    • removeClass().
    • toggleClass().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a junior java developer. I have to make a project that requires
One of the things that you have beaten into you as a junior developer
I am a junior rails developer and was advised to use Class.find(id) to query
I'm a junior .net developer.I have developed a simple client application (.net3.5) which needs
Let's say you have a bug that was found in functional testing of a
I am a junior developer, and trying to write an application to consume SOAP
I am a junior at university and quite new to the .NET framework. Currently
I'm a junior developer, who knows the basics already and have some experience as
I have been developing different java web based applications. As a junior-mid level developer
I am a junior developer and I have just graduated from university this year.

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.