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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:47:58+00:00 2026-06-18T00:47:58+00:00

I have a table with checkboxes. When a checkbox is checked I catch the

  • 0

I have a table with checkboxes. When a checkbox is checked I catch the event with jQuery but this checkbox is immediately unchecked.

The jsfiddle: http://jsfiddle.net/K4uDa

<table>
  <tr>
    <td><input type='checkbox' /></td><td>AA</td>
  </tr>
  <tr>
    <td><input type='checkbox' /></td><td>BB</td>
  </tr>
  <tr>
    <td><input type='checkbox' /></td><td>CC</td>
  </tr>    
</table>


$(function() {

  $("table tr").live("click", function() {
    alert('row clicked');
  });

  $("table tr td input:checkbox").live("click", function() {
   alert('checked/unchecked'); 
   return false;
  });
    
})

Where is the problem?

Sorry, I updated my jsfiddle here: http://jsfiddle.net/K4uDa/1/

I added a ‘return false’ because I don’t want the other event to fire when a checkbox is checked/unchecked.

  • 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-18T00:48:00+00:00Added an answer on June 18, 2026 at 12:48 am

    The way return false works is by combining event.preventDefault() (which as the name implies prevents the default action of the even, such as un/checking the checkbox, following a link or submitting a form…) and event.stopPropagation() (which is what stops the event from propagating to/being ‘heard by’ its ancestor elements). IE does it a little differently, but effectively you want to retain the default action (the un/checking) while discarding the propagation. So, with that in mind I’d suggest:

    $('input:checkbox').click(function(e){
        e.stopPropagation();
        alert(this.checked);
    });
    

    JS Fiddle demo.

    Incidentally, it’s worth pointing out that live() is deprecated in jQuery 1.7 and above (replaced by the on() method), and in versions before jQuery 1.7 the docs (for live()) recommend using delegate() instead.

    But given that you’re binding events directly to the elements themselves, which suggests they’re not dynamically added, you may as well simply use the click() method directly.

    References:

    • click().
    • delegate().
    • event.preventDefault().
    • event.stopPropagation().
    • live().
    • on().
    • window.event.cancelBubble (at MSDN).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that looks like this: http://jsfiddle.net/8SEz2/4/ Branch StSeq# Inv# Invoice Date
Hey guys, I have a question about asp.net I have this table with checkbox
I have a list of checkboxes in a table like this along with a
I have two checkboxes generated like this: <table> <?php foreach ($invited_members as $mem) :
I have an jQuery dialog box, containing table with multiple checkboxes. $(#custom-modal).dialog({ height: 200,
I have the following table that contains checkboxes in each row. When checkbox status
I have a table with some checkboxes in it, and I've added this code
I have this table of data with labels and checkboxes. It's currently set up
I have a table setup like this: <table> <thead> <th> <input type=checkbox class=check-all />
I have a table with checkboxes in the first column. I use the jQuery

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.