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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:31:46+00:00 2026-06-04T06:31:46+00:00

I´m trying to do an replacement for the javascript confirm(). I have found the

  • 0

I´m trying to do an replacement for the javascript confirm(). I have found the jquery dialog() function that can be fully customized. The problem is that i cant make it return true or false.

Here is my code:

$('#delBox').dialog(
        { autoOpen: false, resizable: false, modal: true, closeOnEscape: true, width: 300, height: 'auto', title: 'Deletar registro',
            buttons: {
                "Ok": function () {
                    return true;
                }, "Cancelar": function () {
                    $(this).dialog("close");
                    return false;
                }
            },
            open: function () {
                var buttonsSet = $('.ui-dialog-buttonset').find("button:contains('Ok')");
                buttonsSet.attr("class", "ui-button ui-state-default");
                $('.ui-dialog-titlebar-close span').empty();
                $('.ui-dialog-buttonset').find("button:contains('Ok')").button({
                    text: false,
                    icons: {
                        primary: 'ui-icon-ok'
                    }
                });

                $('.ui-dialog-buttonset').find("button:contains('Cancelar')").button({
                    text: false, 
                    icons: {
                        primary: 'ui-icon-cancel'
                    }
                });
            }
        });

This only return an object before any option selected:

function deletar() {
     alert($('#delBox').dialog('open'));
}
  • 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-04T06:31:47+00:00Added an answer on June 4, 2026 at 6:31 am

    jQueryUI dialog boxes can’t return a true or false as they’re shown on top of other content but without blocking execution.

    The best you can do is:

    1. make the box modal so that it hides the other content

    2. supply callbacks to be used depending on which option is chosen.

    For extra bonus points, you could create a $.Deferred() promise object and return that when you show the dialog. You can then resolve or reject that promise in the button event handlers.

    This would give you clean separation between showing the dialog box, and performing the actions subsequently triggered by it:

    function showDialog() {
       var def = $.Deferred();
    
       // create and/or show the dialog box here
       // but in "OK" do 'def.resolve()'
       // and in "cancel" do 'def.reject()'
    
       return def.promise();
    }
    
    showDialog().done(function() {
        // they pressed OK
    }).fail(function() {
        // the pressed Cancel
    });
    
    // NB: execution will continue here immediately - you shouldn't do
    //     anything else now - any subsequent operations need to be
    //     started in the above callbacks.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit of a problem with a jQuery dialog and the way
I'm trying to make sure that my JQuery ready function is working. In the
I'm trying to find a replacement for popBox, a script that opens a textarea
I'm trying to create a simple prototype in JavaScript that removes a character from
I have googled some time now trying to find a good sample application that
I'm trying to update the source of an image using jQuery. The problem is
I'm trying to write some replacement regex that will insert a locale code into
I have been trying for several hours to implement a GLSL replacement for glTexGen
I'm reading the JavaScript Bible, trying to learn JavaScript like a good jQuery developer.
I found that the more than 60% of the javaScript code generated by GWT

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.