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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:09:02+00:00 2026-06-03T07:09:02+00:00

I have a jquery dialog that uses a non-jquery javascript function to complete the

  • 0

I have a jquery dialog that uses a non-jquery javascript function to complete the functioning depending upon which button is selected. I have added a checkbox within the dialog that the user must check to signify understanding of what will happen.

When I add the testing of the checked state to the non-jquery javascript, the checked state is always returned as false.

Following is the code. The first two alerts and the return statement are for testing:

function acceptPitch()
{

    // the two alerts and return false are for testing only
    alert('jq=' + $('#understand').prop("checked"));
    alert('checkbox=' + document.getElementById('understand').checked);
    return false;
    if (document.getElementById('understand').checked)
    {
        handleUserDelay();
        $('#decision').val('yes');
        document.forms['cancellationForm'].submit();
        return true;
    }
    else
    {
        alert('[appropriate message here]');
        return false;
    }
}

If the checkbox is not in the dialog box, the above function works as expected. But when it is placed inside the dialog box, the tests for “checked” always return false.

Here is the main code for the dialog:

var $dialog_cancel = $('#rh-dialog.cancel');
$dialog_cancel.dialog(
{
    autoOpen:false,
    width:500,
    modal:true,
    draggable:true,
    resizable:false
});

$('#reason').change(function()
{
    var reason1 = $(this).val().substr(0,1);
    if (reason1 == 'n')
    {
        $('#pitch').html($('#pitch-no').html());
        $('#acceptPitchButton').val($('#free-button-text').html());
    }
    else if (reason1 == 'y')
    {
        $('#pitch').html($('#pitch-yes').html());
        $('#acceptPitchButton').val($('#perp-button-text').html());
    }
    else
    {
        validCancelReason();
    }
});

$('#requestCancelButton').click(function()
{
    if (validCancelReason())
    {
        $dialog_cancel.dialog('open');
    }
});

The following is markup taken from a “view source” listing. Please note that jquery is used to only display two of the last four divs, and that some other adjustments are made by the jquery:

<div id="rh-dialog" class="cancel" title="Confirm Cancellation">
    <p>
        This will request cancellation of your continuing subscription service.<br />
    </p>
    <div id="pitch"></div>
    <p style="font-style: italic; margin-top:10px;">
        Please click <strong>YES!</strong> to continue your plan, or <strong>No, Thank You</strong> to cancel.
    </p>
    <div>
        <div id="rh-dialog-button-1">
            <input type="button" id="acceptPitchButton" value="Don't Cancel"  onclick="bar1.showBar(); acceptPitch();" />
        </div>
        <div id="rh-dialog-button-2">
            <input type="button" id="rejectPitchButton" value="No, Thank You, Just Cancel" onclick="bar1.showBar(); rejectPitch();" />
        </div>
    </div>
</div>
<div id="pitch-no" class="no-disp"><strong>GET ONE FREE MONTH!</strong><br />It is very important to us that all of our subscribers have success with our service, not only in speaking with reps but in actually growing your business. Given you are canceling because you were unsatisfied, we would like to offer you <strong>one FREE month.</strong><br /><br />To take advantage of this offer simply click <strong>Yes! Free Month</strong> and your credit card or PayPal account will not be charged for the next month.<br /><br />After your free month, you can choose to cancel your subscription or continue on with our Maintenance plan.<br/><br/><form id="agree-form"><input type="checkbox" id="understand"><strong>I understand</strong> that by requesting a free month I am not canceling my subscription, and that after the free month is over, my credit card or PayPal account will be charged for the next month of service and again every month thereafter until I do cancel.</input></form></div>
<div id="pitch-yes" class="no-disp"><strong>BARGAIN PRICE PERPETUITY PLAN!</strong><br />You realize that placing quality sales reps requires a continual effort trolling for reps at all times because timing is of the essense. For that reason, we would like to offer you our <strong>Perpetuity Plan</strong>.<br /><br />This plan is only USD $79/month, cancel anytime, and you can lock into that rate for life.<br /><br />Click <strong>Yes! Perpetuity Plan</strong> to switch to the Perpetuity Plan.</div>
<div id="free-button-text" class="no-disp">Yes! Free Month - Continue Subscription</div>
<div id="perp-button-text" class="no-disp">Yes! Perpetuity Plan</div>

In addition, I am adding a screen shot:

screen shot showing dialog with checkbox
(source: oofdah.com)

  • 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-03T07:09:03+00:00Added an answer on June 3, 2026 at 7:09 am

    I have adopted as the solution the potential solution noted in my comment above. The solution is adapted from jQuery UI Dialog with ASP.NET button postback.

    Essentially the approach I used from that other question was given there as follows:

    dlg.parent().appendTo(jQuery("form:first"));
    

    In my case, I adapted that approach by adding this jQuery statement after my dialog was defined:

    $dialog_cancel.parent().appendTo($('#cancellationForm'));

    After having that statement present, both the jQuery and plain javascript approaches work. That is, either of the two following statements can be used:

    alert('jq=' + $('#understand').prop("checked"));
    alert('checkbox=' + document.getElementById('understand').checked); 
    

    After using this approach, because of the change to the DOM I had to slightly tweak the styling, because of styles that were applied due to the DOM change.

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

Sidebar

Related Questions

I have a dialog window that uses a URL for its contents { function(){jQuery.ajax({'success':function(html)
I have a simple Jquery dialog box, that dialog contains a button which sends
I have a button that uses jQuery and ajax to call a server side
I have an ASP.NET website which uses the jQuery dialog to present the user
I have a JQuery Dialog that is opened when a button is clicked. The
I have a dialog that uses jQuery UI and is opened by clicking on
I have a function resizePreview() that will resize an image in a jQuery dialog
I have an application that uses jQuery to open a dialog box with a
I have a jQuery dialog that posts a form when the Please Confirm button
I have a jquery-ui-dialog that contains a <form> which contains a <input type=file >

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.