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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:05:08+00:00 2026-05-31T13:05:08+00:00

EDIT This question is NOT a dupe of Setting "checked" for a checkbox with

  • 0

EDIT This question is NOT a dupe of Setting "checked" for a checkbox with jQuery? because this question here specifically asks about the special case where: “Once a user clicks on a checkbox, that checkbox stops responding to the “checked” attribute changes.”.

There’s one answer (one with few upvotes compared to the other) that talks about that, but all the links in that answer are utterly broken…

I’m trying to do something “out of curiosity”. There’s no point in what I’m trying to do.

I successfully used JQuery to display if a checkbox just got checked or unchecked using an alert. The following works fine:

$(document).ready(function() {
  $('.cb').change(function(){
    if ($('.cb').is(':checked')) {
      alert('changed to checked');
    } else {
      alert('changed to unchecked');
    }
   });
});

However I can’t figure out how to turn back the checkbox to its initial state (once again: there’s no point in doing that, but I want to do it).

Is it possible to do that and will is it possible to toggle back the checkbox to its original state without triggering the change event?

I tried attr and removeAttr to no avail.

  • 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-31T13:05:09+00:00Added an answer on May 31, 2026 at 1:05 pm

    check my fiddle:

    http://jsfiddle.net/QvaEA/

    $(document).ready(function() {
      $('.cb').change(function(){
        if ($(this).is(':checked')) {
            alert('changed to checked -> uncheck again');
            $(this).attr('checked', false);
        } else {
            alert('changed to unchecked -> recheck');
            $(this).attr('checked', true);
        }
       });
    });​
    

    in callbackfunctions you should always use $(this) to access the triggering element. in your code, you would always check (and change) all checkboxes with the class cb.

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

Sidebar

Related Questions

Edit: This is not a dupe of my last question as I didn't want
EDIT: This question is more about language engineering than C++ itself. I used C++
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying
First of all, this is not a dupe of this question . You'll see
Not sure if I should edit this question or just ask another question in
EDIT: This question was originally about checkboxes, but I am getting the same behavior
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT : This question duplicates How to access the current Subversion build number? (Thanks
(EDIT: This question is now outdated for my particular issue, as Google Code supports
Edit This question has gone through a few iterations by now, so feel free

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.