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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:50:36+00:00 2026-05-13T01:50:36+00:00

I have the following problem to be solved. I have few rows of data.

  • 0

I have the following problem to be solved.

I have few rows of data. When i click one row the color of the row has to be changed and when i click the other row the color of the previous selected row should become normal and the current row should be highlighted with the color. This is done through the following code.

Check = function()
{

    $('tr').click(function(){
        $('tr').removeClass("coloradd");
        $(this).addClass("coloradd");

    });

};

But now a complexity is added to the requirements. When i press the shift key and select multiple rows the selected rows should get highlighted. Could anyone help me out with this?

  • 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-13T01:50:37+00:00Added an answer on May 13, 2026 at 1:50 am

    You can test for the shift key like this (I also included a little optimization):

    $('tr').click(function(e){
        // Only run if Shift key is not held down
        if(!e.shiftKey) $('tr.coloradd').removeClass("coloradd");
    
        // Always select the current row
        $(this).addClass("coloradd");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my home work of Ackermann function I have solved the problem as following
I have following problem: I have to make a ASP.NET Webapplication with a two-row
I have the following problem that needs to be solved in a MySQL query:
I have the following XML in a string: <RootElement> <Data> <Row> <id>1</id> <name>Foo</name> </Row>
Can't figure out how to resolve following problem: I have a few actors (workers)
I have the following problem that I want to solve in awk. I have
I have the following problem that the standard library doesn't solve well, and I'm
I am trying to solve the following problem with Puppet: I have multiple nodes.
i'm not sure how to solve the following problem: i have a triangle with
I'm trying to solve the following problem in Redis. I have a list that

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.