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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:45:38+00:00 2026-05-27T08:45:38+00:00

I want an event to fire client side when a checkbox is checked /

  • 0

I want an event to fire client side when a checkbox is checked / unchecked:

$('.checkbox').click(function() {
  if ($(this).is(':checked')) {
    // Do stuff
  }
});

Basically I want it to happen for every checkbox on the page. Is this method of firing on the click and checking the state ok?

I’m thinking there must be a cleaner jQuery way. Anyone know a solution?

  • 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-27T08:45:39+00:00Added an answer on May 27, 2026 at 8:45 am

    Bind to the change event instead of click. However, you will probably still need to check whether or not the checkbox is checked:

    $(".checkbox").change(function() {
        if(this.checked) {
            //Do stuff
        }
    });
    

    The main benefit of binding to the change event over the click event is that not all clicks on a checkbox will cause it to change state. If you only want to capture events that cause the checkbox to change state, you want the aptly-named change event. Redacted in comments

    Also note that I’ve used this.checked instead of wrapping the element in a jQuery object and using jQuery methods, simply because it’s shorter and faster to access the property of the DOM element directly.

    Edit (see comments)

    To get all checkboxes you have a couple of options. You can use the :checkbox pseudo-selector:

    $(":checkbox")
    

    Or you could use an attribute equals selector:

    $("input[type='checkbox']")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to fire a server-side ASP.NET button click event in JavaScript. I checked
i want my textbox to fire a textChanged client side (JS) event when a
I want to let TextBox control TextChanged event fire only when there are more
i want to fire an event manually using c#. For instance, say if i
I want to have a generic event that I can fire that will take
I have a asp:textbox with a OnTextChanged event that I want to fire when
I want to fire event in custom class written in Extjs 4. I created
I have created a button programmatically and I want to fire event to go
I have a table that I want to add a click event to the
I have ImageButton in a MasterPage. I want the OnClick event to fire and

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.