KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am new to javascript and jQuery. I am trying to implement a modal dialog using jQuery UI widgets. The modal dialog shows up correctly with OK and Cancel buttons, but the dialog('open') function call does not seem to block and wait for an OK or Cancel click. For example, when I run the following code .....on button click okToDelete = false; //a global variable $('deleteDialog').dialog('open'); //this does not block but returns immediately alert(okToDelete == true ? "ok" : "false"); The alert box is displayed first and THEN the modal dialog shows up! okToDelete is a global variable I set to false when I enter the function and set to true in the OK button callback. Here is my dialog init function $("#deleteDialog").dialog({ bgiframe: true, autoOpen: false, modal: true, overlay: { backgroundColor: '#000', opacity: 0.5 }, buttons: { Cancel: function() { $(this).dialog('close'); }, Ok: function() { $(this).dialog('close'); okToDelete = true; } } });
Tags (comma-separated)
Save Edits
Cancel