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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:40:17+00:00 2026-06-03T09:40:17+00:00

I have modal jQuery UI dialog with a checkbox: $dialog = $(‘<div id=formContainer></div>’) .html(‘<div>some

  • 0

I have modal jQuery UI dialog with a checkbox:

            $dialog = $('<div id="formContainer"></div>')
                        .html('<div>some text</div><input id="accept_cb" type="checkbox" checked="checked"/> Uncheck this box to disable.<br />')
                        .dialog({
                                autoOpen: false,
                                title: 'Title ',
                                modal: true,
                                buttons: {
                                    "Close": function() {
                                        checkboxHandler();
                                    },
                                    Cancel: function() {
                                        $( this ).dialog( "close" );
                                    }
                                }
                            });


            function checkboxHandler(){
                if ($('#accept_cb').is(':checked'))
                {
                  alert('checked');
                }else{
                  alert('not checked');
                }
            }

When I open the dialog the first time everything works just fine and alerts the correct checked status. But when I return a second time the status stays either ‘checked’ or ‘not checked’ whatever it was the first time. What do I need to change?

I also tried with ().attr and ().prop, same result.

  • 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-03T09:40:19+00:00Added an answer on June 3, 2026 at 9:40 am

    Closing a dialogue does not destroy it. Although you don’t mention how you are opening the dialogue, I imagine that you are just running this code again. If so you are creating duplicates of all these elements. When you have 2 elements with the same ID on a page, your browser will always return the first one, hence your “whatever it was the first time”.

    Either .remove() the dialogue in the “close” handler, or don’t re-create the contents each time.

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

Sidebar

Related Questions

I have a jQuery modal dialog with an iFrame in it that shows some
I have an HTML link that opens a jQuery modal dialog which contains an
My Needs: I am using a jquery modal dialog. I have some buttons on
I have a simple jQuery dialog box that has an html input inside it.
I have a jquery modal dialog, and I am trying to change the text
I have an overflow div which is on a jquery modal dialog. <div style=overflow:
I have a jquery modal dialog that displays a partial view. The partial view
I have a problem with Jquery UI modal dialogs. I have modal dialog (dialogA),
I have a modal dialog plugin written in jquery, that binds to the click
I have an HTML form: <div id=dialog class=event-dialog title=Create Event> <div id=dialog-inner> <table> <tr><td

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.