Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I just had to solve the same problem. The key to getting this to work was that the <code>dialog</code> must be partially initialized in the <code>click</code> event handler for the link you want to use the confirmation functionality with (if you want to use this for more than one link). This is because the target URL for the link must be injected into the event handler for the confirmation button click. I used a CSS class to indicate which links should have the confirmation behavior. </p> <p>Here's my solution, abstracted away to be suitable for an example. </p> <pre><code>&lt;div id="dialog" title="Confirmation Required"&gt; Are you sure about this? &lt;/div&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#dialog").dialog({ autoOpen: false, modal: true }); }); $(".confirmLink").click(function(e) { e.preventDefault(); var targetUrl = $(this).attr("href"); $("#dialog").dialog({ buttons : { "Confirm" : function() { window.location.href = targetUrl; }, "Cancel" : function() { $(this).dialog("close"); } } }); $("#dialog").dialog("open"); }); &lt;/script&gt; &lt;a class="confirmLink" href="http://someLinkWhichRequiresConfirmation.com"&gt;Click here&lt;/a&gt; &lt;a class="confirmLink" href="http://anotherSensitiveLink"&gt;Or, you could click here&lt;/a&gt; </code></pre> <p>I believe that this would work for you, if you can generate your links with the CSS class (<code>confirmLink</code>, in my example).</p> <p>Here is a <a href="http://jsfiddle.net/Raitono/jcxv8qom/1/" rel="noreferrer">jsfiddle</a> with the code in it.</p> <p>In the interest of full disclosure, I'll note that I spent a few minutes on this particular problem and I provided a similar answer to <a href="https://stackoverflow.com/questions/878710/is-a-modal-confirm-box-using-jquery-possible">this question</a>, which was also without an accepted answer at the time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload