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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:44:15+00:00 2026-06-04T01:44:15+00:00

I have the following table that contains checkboxes in each row. When checkbox status

  • 0

I have the following table that contains checkboxes in each row. When checkbox status is changes (checked/unchecked), the corresponding row need to be highlighted in yellow color. How can we achieve it using jQuery?

Note: I am using jQuery 1.4.1? “on” is not supported.

Note: I am trying to learn jQuery. Please do NOT suggest any third party plugin. I am trying to learn it though coding by hand.

<html>
<table class="commonGrid" cellspacing="0" id="detailContentPlaceholder_grdGarnishmentState"
style="border-collapse: collapse;">
<thead>
    <tr>
        <th scope="col">
            <a >
                Country Code</a>
        </th>
        <th scope="col">
            <a >
                State</a>
        </th>
        <th scope="col">
            Independent Order Status
        </th>
        <th scope="col">
            Standard Order Status
        </th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>
            USA
        </td>
        <td>
            <span id="detailContentPlaceholder_grdGarnishmentState_lblState_0">Alaska</span>
        </td>
        <td>
            <span class="independantOrder">
                <input id="detailContentPlaceholder_grdGarnishmentState_chkIndependentOrderStatus_0"
                    type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl02$chkIndependentOrderStatus"
                    checked="checked" /></span>
        </td>
        <td>
            <span class="standardOrder">
                <input id="detailContentPlaceholder_grdGarnishmentState_chkStandardOrderStatus_0"
                    type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl02$chkStandardOrderStatus"
                    checked="checked" /></span>
        </td>
    </tr>
    <tr style="background-color: #E5E5E5;">
        <td>
            USA
        </td>
        <td>
            <span id="detailContentPlaceholder_grdGarnishmentState_lblState_1">Arkansas</span>
        </td>
        <td>
            <span class="independantOrder">
                <input id="detailContentPlaceholder_grdGarnishmentState_chkIndependentOrderStatus_1"
                    type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl03$chkIndependentOrderStatus" /></span>
        </td>
        <td>
            <span class="standardOrder">
                <input id="detailContentPlaceholder_grdGarnishmentState_chkStandardOrderStatus_1"
                    type="checkbox" name="ctl00$detailContentPlaceholder$grdGarnishmentState$ctl03$chkStandardOrderStatus"
                    checked="checked" /></span>
        </td>
    </tr>
</tbody>
</table>
</html>
  • 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-04T01:44:16+00:00Added an answer on June 4, 2026 at 1:44 am

    Assumption based on your notes etc: Highlight a row in yellow when a checkbox changes.

    $("table").on("change", ":checkbox", function() {
        $(this).parents("tr:first").css('background-color','yellow');
    });
    

    Effect: If a row checkbox changes, it highlights. Notes: Never changes to NOT be hightlighted once it IS highlighted in yellow.

    EDIT: You COULD use a highlight class from your CSS such as .highlight{background-color:yellow;} however, on the second row, you would need to remove the background color style embedded there as that is more “specific” AND will always override the class added with .addClass('highlight');

    previous versions syntax of a change event handler:

    $("table").find(':checkbox').change( function() {
        $(this).parents("tr:first").css('background-color','yellow');
    });
    

    Slower .live handler for dynamic element addition:

    $("table").find(':checkbox').live('change', function() {
        $(this).parents("tr:first").css('background-color','yellow');
    });
    

    EDIT2: There were a LOT of event management changes from 1.4.1 to 1.4.4.

    It seems the change event is not firing for the 1.4.1 correctly – only fires on second change. SO, use the click event instead:

    jQuery('input').click(function() {
        jQuery(this).parents("tr:first").css('background-color', 'yellow');
    });
    

    working example here: http://jsfiddle.net/vW9vQ/1/

    BROKEN .change test here: http://jsfiddle.net/vW9vQ/

    Highly recommend update to current release of jQuery on this stuff.

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

Sidebar

Related Questions

I have the following requirement. I have a table with a column that contains
I have a page that contains a table with the following format: <table id=gigsTable>
I have the following problem (simplified): I have a table that contains animals, e.g:
I have a T-SQL table that contains the following columns: Date, StationCode, HDepth, and
I have view that contains a table with the following structure: <table id=mappings> <thead>
I have a table that contains the following sample data:- ID Description 1 John
I have a table that contains the following information date sales 2011-02-13 1 2011-02-13
I have a SQL Server table that contains the following fields: SessionId (guid) Message
I have a table that contains the following data: +----+----------+ | ID | ParentID
This is for MySQL and PHP I have a table that contains the following

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.