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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:33:15+00:00 2026-05-21T21:33:15+00:00

If i have 5 links.When first if i click a link it has to

  • 0

If i have 5 links.When first if i click a link it has to change to some other color and next if i click other link previous link color should go to default and this link color has to change

CODE:

$("table#menu tr > td a[href^='#']").click(function() { 
     $(this).toggleClass('class1'); / 
}); 

a.class1 { color:#000000; } 

<table id="menu"> 
<tr> 
   <td><a href="#" id="link1">qwerty</a></td> 
</tr> <tr> 
   <td><a href="#" id="link1">zyz</a></td> 
</tr> 
</table>
  • 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-21T21:33:16+00:00Added an answer on May 21, 2026 at 9:33 pm

    This should answer your question:

    http://jsfiddle.net/TL9rh/

    html

    <div id="links">
        <a href="#">link1</a>
        <a href="#">link2</a>
        <a href="#">link3</a>
        <a href="#">link4</a>
        <a href="#">link5</a>
    </div>
    

    javascript

    $(document).ready(function(){
        $('#links a').click(function(){
            $(this).addClass('selected');
            $(this).siblings().removeClass('selected');
        });
    })
    

    css

    a {
        color: darkgreen;   
    }
    
    
    .selected {
         color: red;   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two types of links that are event-bound. If the clicked-on link has
I have this jquery: $('.tbl-link').click(function(){ $('.tbl-content').animate({ opacity: 'show', //height: '+=300px', marginTop: '330px' }, 1200).css({
Okay. I have completed my first python program.It has around 1000 lines of code.
I have links like these that I want to change: mypage.com?page=missions&id=5 mypage.com?page=hello I tried
Scenario: I have an outline where I have links for my menu. Each link
I have 2 anchor links (a.selector) and when one is clicked it has a
So imagine this scenario, I have a list and it has a bit of
I have inherited an application that uses telerik controls. This is my first time
I have an ordered list, and each item has a link with class additem
I know this question has been asked many times and we have gotten 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.