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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:33:31+00:00 2026-05-22T01:33:31+00:00

I have a checkbox that when gets clicked will open up a dialog. If

  • 0

I have a checkbox that when gets clicked will open up a dialog. If “Done” is clicked, I want the checkbox to have a checkmark. If “Cancel” is clicked, I want the checkbox not to have a checkmark.

Currently, I cannot get the checkbox to be set while using this code:

    <script type="text/javascript">
            $(document).ready(function() {
                    var dialog = $("#test-dlg").dialog({
                            modal:true,
                            autoOpen:false,
                            buttons: {
                                    "Done": function() { $("#test-chk").attr("checked", "checked"); $(this).dialog("close"); },
                                    "Cancel": function() { $("#text-chk").removeAttr("checked"); $(this).dialog("close"); }
                            }
                    });

                    $("#test-chk").click(function(e) {
                            dialog.dialog('open');
                            e.preventDefault();
                    });
            });
    </script>
</head>
<body>
    <form action="#">
            <input type="checkbox" id="test-chk" /><label for="test-chk">Testing</label>
    </form>
</body>
<div id="test-dlg">
    <p>Test Dialog</p>
</div>
  • 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-22T01:33:32+00:00Added an answer on May 22, 2026 at 1:33 am

    You are using jQuery 1.6, so you need to use .prop() instead of .attr().

    change this: $("#test-chk").attr("checked", "checked");

    to this: $("#test-chk").prop("checked", "checked");

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

Sidebar

Related Questions

I have a checkbox that when it is clicked it submits the form to
I have datagridview with checkbox column, but I want, that some of the columns
I have a ListView with a checkbox field inside that gets the id set
I would like to have a checkbox preference that takes the user to a
I have a CheckBox in my application that is using the TriState mode. The
i have disabled all the checkboxes except one. On click of that checkbox i
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have an aspx page that contains a checkbox, and a button. The button
I have a Custom Control that has multiple textbox fields and a checkbox contained
I have a web page that consists of a checkbox (parent) and on this

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.