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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:12:08+00:00 2026-06-17T22:12:08+00:00

I have a table where each row has a <input type=checkbox /> in the

  • 0

I have a table where each row has a <input type="checkbox" /> in the first cell.

I have a click handler setup on the <tr> which among other things toggles the checkbox.

This is working perfect, unless I click on the actual checkbox, which results in the checkbox having the opposite state to what it was supposed to be as it gets toggled twice, once by it’s default behavior, and once by the <tr> event handler.

What I want to do is basically ignore the checkbox click, and just respond to the click on the tr.

Here is my event handler for the tr

$('.files-table tbody').on('click', 'tr', function (e) {
    var check = $('.check', this);
    check.prop('checked', !check.prop('checked'));

    check.prop('checked') ? selected++ : selected--;
    numSelected.html(selected + ' item' + (selected === 1 ? ' ' : 's ' ) + 'selected: ');
    if (selected == 1) {
        withSelected.addClass('in').removeClass('hide');
        noSelected.removeClass('in').addClass('hide');
    } else if (selected == 0) {
        withSelected.removeClass('in').addClass('hide');
        noSelected.addClass('in').removeClass('hide');
    }

    if (check.prop('checked')) {
        selectedItems[check.data('type')].push(check.data('id')+"");
    } else {
        selectedItems[check.data('type')].splice(check.data('id')+"");
    }
    console.log(selectedItems);
    $(this).toggleClass('info');
});

And here is an example row:

<tr>
    <td style="width:15px;">
      <input class="check" type="checkbox" data-id="6" data-type="directories">
    </td>
    <td>
      <a href="/files/browse/1. First/1.1 First Child of First/6" 
         class="needs-tooltip" 
         title="Browse Directory">
        <i class="icon icon-folder-close"></i>
      </a> 
      1.1 First Child of First
    </td>
    <td>Directory</td>
    <td>0 Items</td>
    <td>27 Jan 2013</td>
    <td>--</td>
    <td>--</td>
</tr>
  • 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-17T22:12:08+00:00Added an answer on June 17, 2026 at 10:12 pm

    You can check where the click originated from:

    if ( ! $(e.target).is(':checkbox') ) {
        $('.check', this).prop('checked', function (i, el) {
            el.checked ? selected-- : selected++;
            return ! el.checked;
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with id=selector. Each row's cell has a corresponding input to
I have a DB table in which each row has a randomly generated primary
I have a table with 3 rows. Each row has 3 td. The first
I have an HTML table where each row has buttons which toggle status bits
I have a table style page with rows. Each row has a checkbox. I
I have a table where each row has a description field as well as
I have a table where each row has 13 TD elements. I want to
I have a table column where each row has one of three states, and
I have a table with many rows and each row has select lists. Something
I have a massive table with thousands of rows. Each row has a unique

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.