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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:12:04+00:00 2026-05-24T09:12:04+00:00

note: all this is on chrome I am trying to test something that responds

  • 0

note: all this is on chrome

I am trying to test something that responds to a click a checkbox. I realize jQuery.click() exists, but it seems to be different from a “native” click in that during the click handler, the state of the checkbox isn’t updated yet (so checkbox is unchecked, you call .click(), in the handler, checkbox is still unchecked. If you actually click the box, in the handler the state is checked).

I apologize for the confusing question, here is a fiddle http://jsfiddle.net/XBhWy/

Click the foo button, notice that button handler says it has been checked, but the checkbox handler says it has not been checked (even though the ui shows a checkmark). Now, click the checkbox itself. Notice the click event handler is reporting what you would expect it to report.

My question is how to simulate the same thing that happens when you actually click the box.

Now, I took a stab at a better simulated event like this

$.fn.check = function() {
  if ($(this).is(':checked')) {
    $(this).attr('checked', 'checked');
  } else {
    $(this).removeAttr('checked');
  }
  $(this).click();
}

Unfortunately (and somewhat confusingly), it didn’t work.

Anyone run into this before? Can it be accomplished?

Note that I’m not looking for the click method.

  • 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-24T09:12:05+00:00Added an answer on May 24, 2026 at 9:12 am

    It would seem that the user-specified function declared in the checkbox click() event fires BEFORE the checkbox is really updated. I played around with it and found that the change() listener acts as expected.

    jsfiddle

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

Sidebar

Related Questions

My table is like this on Postgres, note that all days start by 01,
We all know that having a good note taking tool is important as a
Note that I am not asking which to choose (MVC or MVP), but rather
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
Note: Using Monotouch. I have a directory called Images where I have all my
How can I replace CHAR with VARCHAR2 in all tables in a schema? Note:
Note: This was posted when I was starting out C#. With 2014 knowledge, I
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
I am not able to figure out why this does happen. On all non-webkit
I'm looking at using less . js (looks great), but our site requires that

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.