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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:28:29+00:00 2026-05-31T20:28:29+00:00

I am using jQueryUI to make a confirmation popup to save. I am writing

  • 0

I am using jQueryUI to make a confirmation popup to save. I am writing a finishing function for when the user is done editing everything. The popup comes up and the rest of the finishing function goes on before the confirmation is selected “don’t save” “save” or “cancel”. I am using the confirmation several times, so I can’t change that specifically for this instance.
How do I make the function wait for the results of the confirmation?

    $("#dialog").dialog({
            autoOpen: false,
    modal: true,
    title: 'Save Changes',
    buttons: {
        "Don't Save": function() {
            setDivText();
            $( this ).dialog( "close" );
        },
        Cancel: function(){
            $("#selection option:selected").removeAttr("selected");
            $.each($("#selection option"), function(){
                if($(this).val() == prevSel){
                    $(this).attr('selected', 'selected');
                }
            });
            $(this).dialog("close");
        },
        "Save": function(){
            organizedDivs[prevSel][2] = tinyMCE.activeEditor.getContent();
            setDivText();
            $(this).dialog('close');
        }
    }
});

and

function output(){
if(tinyMCE.activeEditor.isDirty()){
    $("#dialog").dialog('open'); 
    saveAll();
} else {
    saveAll();
}
}

and

function saveAll(){
$.each( fileText.match( /<div.*?class=".*?editable.*?".*?>[\s\S.]*?<.div>/g ), function( index, value ){
    value.replace(/(id=".*?".*?>)([.\s\S]*?)(<.div>)/ ,"$1" + organizedDivs[index][2] + "$3"); 
});
}
  • 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-31T20:28:30+00:00Added an answer on May 31, 2026 at 8:28 pm

    ==== UPDATED answer:

    OK, I admit that this is a ugly solution, since what I know for ‘halting’ the javascript program is: alert(), confirm(), and sometimes $.ajax({async:false}). :

    so my solution is simply re-implement the code by adding the “saveAll()” to the end of each callback function:

    $("#dialog").dialog({ autoOpen: false, modal: true, title: 'Save Changes',
    buttons: {
        "Don't Save": function() {
            setDivText();
            $( this ).dialog( "close" );
            saveAll();       // newly added line of code       
        },
       "Cancle": function(){
            //....
            $( this ).dialog( "close" );
            saveAll();       // newly added line of code       
        },
       "Save": function(){
            //....
            $( this ).dialog( "close" );
            saveAll();       // newly added line of code       
        }
     // other code...
    }
    
    // and in your "finishing function"
    function output(){
      if(tinyMCE.activeEditor.isDirty()){
        $("#dialog").dialog('open'); 
        // this line of code : saveAll() was removed from here. 
      }else{
        saveAll();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using this jquery to make a drag and drop sortable list. http://jqueryui.com/demos/sortable/
I'm currently using a hover effect using jQueryUI like this: $('#menu-header-menu li a').hover( function()
I'm using the jQueryUI autocomplete() function and I can't figure out how to have
I'm using jQuery UI Autocomplete plug-in. I'm giving it an URL to make an
was wondering if there is a way to make superfish using jquery ui theme
I'm trying to follow http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/ And have created a very simple example http://jsfiddle.net/6wbZQ/ It's
I'm using JqueryUI for drag and drop on one of my pages and for
I am using jqueryUI datepicker for a reservation form. here's the almost intact code
I am developing an application using jQueryUI. I am also using the Themeroller. I
I'm using http://jqueryui.com/demos/tabs/#manipulation . I want to get an title of current selected tab

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.