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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:57:55+00:00 2026-06-02T09:57:55+00:00

In my current JQuery, I have an event that will either check or uncheck

  • 0

In my current JQuery, I have an event that will either check or uncheck a checkbox if the user clicks on a row in a table. The problem with this is, if the user actually checks the checkbox, the jquery will fire on the checkbox event and either check/uncheck the box, but then the TR event will fire and then undo the checkbox value.

See an example here: http://jsfiddle.net/radi8/KYvCB/1/

I can disable the checkbox but then if the user tries to select the checkbox, the TR event will not trigger.

What I need is a method to disable the ‘click’ event of the checkbox but still allow the TR event to fire when the checkbox is selected.

var charges = {
    init: function() {
        // get the selected row checkbox
        //$('.charges').attr('disabled', true);
        $('.rowclick tr').click(function() {
            if ($(this).find('td input.charges:checkbox').is(':checked')) {
                $(this).find('td input.charges:checkbox').attr("checked", false);
            }
            else {
                $(this).find('td input.charges:checkbox').attr("checked", true);
            }
        });
    }
};
charges.init();
  • 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-02T09:57:59+00:00Added an answer on June 2, 2026 at 9:57 am

    You need to check if the click event was fired on a checkbox or somewhere else. This needs less ressources than a second event handler for the checkbox with e.stopPropagation.

        $('.rowclick tr').click(function(e) {
            if($(e.target).closest('input[type="checkbox"]').length > 0){
                //Chechbox clicked
            }else{
                //Clicked somewhere else (-> your code)
                if ($(this).find('td input.charges:checkbox').is(':checked')) {
                    $(this).find('td input.charges:checkbox').attr("checked", false);
                }
                else {
                    $(this).find('td input.charges:checkbox').attr("checked", true);
                }
            }
        });
    

    Working example: http://jsfiddle.net/KYvCB/5/

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

Sidebar

Related Questions

I have a simple bit of jQuery which displays the row below the current
I'm using javascript and jQuery. I have a problem that my web app has
I have written a simple jQuery dialog box that will appear in an asp
how can i select the current link via jquery if I have a div
I have a jquery datepicker which is renders the current date by default as
I have the following JQuery statement and it is adding the class 'current' but
Hi I have created a user message page with this plugin. The grid will
I have a website that uses Jquery and Python. I have an Ajax Request
On a page I have multiple Jquery UI Sliders that fade out/in the opacity
I have got a link with the click event in my JQuery, something like

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.