Show modal when using javascript confirm
<p>I have the following function that will show a modal:</p>

<pre><code>confirmModal: function (message) {

// CODE TO SHOW MODAL HAS BEEN REMOVED FOR THIS QUESTION //

}
</code></pre>

<p>And because it's been namespaced it's called like: <code>uiModal.confirmModal('Test message');</code></p>

<p>Inside the modal I have two buttons:</p>

<pre><code>&lt;button class="cancel"&gt;Cancel&lt;/button&gt;
&lt;button class="ok"&gt;Ok&lt;/button&gt;
</code></pre>

<p>Now what I want to do is two things:</p>

<ol>
<li><p>When I do something like: <code>onsubmit="confirm('Are you sure?');"</code> or <code>onclick="confirm('Are you sure?');"</code> it will show the modal instead of an alert box. Note that it needs to work for both links and form submits.</p></li>
<li><p>The two buttons in the modal need to either cancel or allow the request to happen. I have already got the cancel to close the modal fine so it's just a case of allowing or denying the request to happen.</p></li>
</ol>

<p>Can anyone help? I've looked at some other questions on here and seen bits about using <code>window.location($(this).attr('href'))</code> but that would only work on links and not for the submit of a form.</p>

<p>I've also looked at doing window.confirm = uiModal.confirmModal('message'); but how would I use that in my example of an onclick or onsubmit</p>

<p>Thanks</p>
