title: How to stop script when using jQuery Dialog?
body: <p>I'm sure this has been asked here many times. The <a href="https://stackoverflow.com/q/10663079/2063610">latest</a> one I saw was on <em>Dec. 2012</em>. But I would like to ask if someone's got a <strong>fix/better workaround</strong> for this problem.</p>
  
  <p>I'm using <code>jQueryUI Dialog</code> and I would like to ask if it is possible to <strong>stop the script execution</strong> when the dialog pops up and the user haven't selected an answer yet. Just like the javascript <code>confirm()</code> does. </p>
  
  <p>Here's what I have so far:</p>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>$("#GlobalDialogBox").dialog({
          modal: true,
          buttons: {
          "Yes": function () { 
              callbackFunctionTrue();
              $(this).dialog('close'); 
           },
          "No": function () { 
              callbackFunctionFalse();
              $(this).dialog('close'); 
           }
        }
      });
  
     alert("This should fire after answering the dialog box."); //but this fires as soon as the dialog pops up.. :(
  </code></pre>
  
  <p>The <code>alert</code> is a common part of the script that fires after answering the dialog box regardless of the answer. On my fix, I just inserted the <code>alert</code> in <code>callbackFunctionTrue()</code> and <code>callbackFunctionFlase()</code> and it does the job. </p>
  
  <p>But what if I don't want to do that? How would I stop the script when the dialog pops up so that I can freely add my codes below the <code>dialog</code> script? Does anybody have a better solution? Any help would be appreciated! Thanks in advance! :]</p>