Intercept click event on a button, ask for confirmation, then proceed
<p>Based on a variable <code>SomeCondition</code>, I need to intercept a click event on a button, and ask for confirmation, if they say ok, proceed, otherwise ignore click.</p>

<p>So something like:</p>

<pre><code>if(SomeCondition) {

// disable click on button

var isOk = window.confirm("Are you sure?");

if(isOk) {
        $("#button1").click();
}

}
</code></pre>

<p>Note: button1 has already been wired up with a click event via javascript from an external .js file that I can't change.</p>

<p>I don't know what the click event was bound too, so I have to disable the click if SomeCondition is true, then ask for confirmation, then continue with the click.</p>
