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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:28:59+00:00 2026-05-20T18:28:59+00:00

I have a table like this, and i have a checkbox at each row

  • 0

I have a table like this, and i have a checkbox at each row and checkboxes on each column. So i want to show/hide an tick mark image next to data in each td when i check the checkbox in the row and table headers. And the tick mark should hide when i uncheck.

Demo of this: http://jsfiddle.net/MpzXU/3/

<table id="example">
      <thead>
        <tr>
          <th></h>
          <th>PO Number</th>
          <th>Hangtag<input type="checkbox" value="hangtag" class="ht_chkbx"/></th>
          <th>Care Label<input type="checkbox" value="Care Label" class="cl_chkbx"/></th>
          <th>UPC<input type="checkbox" value="UPC" class="upc_chkbx"/></th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><input type="checkbox" name="checkbox2" id="checkbox2"></td>
          <td>6711112</td>
          <td>1</td>
          <td>20</td>
          <td>17</td>
        </tr>
      </tbody>
    </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-20T18:28:59+00:00Added an answer on May 20, 2026 at 6:28 pm

    JSFiddle Demo (edited to match comments)

    I change the color of the text on checkbox change by adding a class.
    For each i check if both corresponding checkboxes (line and column) are unchecked before removing the class.

    HTML

    <table id="example">
    <thead>
        <tr>
            <th></th>
            <th>A <input type="checkbox" /></th>
            <th>B <input type="checkbox" /></th>
            <th>C <input type="checkbox" /></th>
            <th>D <input type="checkbox" /></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1 <input type="checkbox"></td>
            <td>A1</td>
            <td>A2</td>
            <td>A3</td>
            <td>A4</td>
        </tr>
        <tr>
            <td>2 <input type="checkbox"></td>
            <td>B1</td>
            <td>B2</td>
            <td>B3</td>
            <td>B4</td>
        </tr>
        <tr>
             <td>3 <input type="checkbox"></td>
             <td>C1</td>
             <td>C2</td>
             <td>C3</td>
             <td>C4</td>
         </tr>
     </tbody>
    

    jQuery

    var headers = $('#example th');
    $(':checkbox', '#example').change(function(e){
        var isChecked = $(this).is(':checked');
        if( $(this).closest('thead').length ){ //columns checkboxes
            //getting the column index
            var i = headers.index( $(this).parent() );
    
            $('tbody tr', '#example').each(function(){
                var isLineChecked = $(':checkbox:checked', this).length;
    
                if( isChecked && isLineChecked  ){
                    $(this).find('td:eq('+i+')').addClass('selected');
                } else {
                    $(this).find('td:eq('+i+')').removeClass('selected');
                }
            });
    
        } else { //line checkbox   
            var columnsCheckboxes = $(':checkbox', headers);
    
            $(this).parent().siblings().each(function(i, td){
                if( isChecked && columnsCheckboxes.eq(i).is(':checked') ){
                    $(this).addClass('selected');
                } else {
                    $(this).removeClass('selected');
                }
            });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of checkboxes, looking like this: <table> <tr><td><input type=checkbox /> <label>Bla</label></td></tr>
I have a table with misc. data. Each row has a checkbox. This table
I have a table and want to calculate each element like: calc-this-cost * calc-this-cost(value
I have a large data table that contains a checkbox for each row. I
I have JqGrid with RadioButton per each row like this. ... { name: 'select',
Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
I have a table like this: <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body
I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
I have a Table like this one: |UserId | ContactID | ContactName --------------------------------------- |

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.