jConfirm and onbeforeunload
<p>I have a basic function to alert the user upon refresh, browser back button (except the submit button) or when a link is clicked they will lose form data from a form wizard.</p>

<pre><code>&lt;script type="text/javascript"&gt;
var okToSubmit = false;
window.onbeforeunload = function() {
    document.getElementById('Register').onclick = function() { okToSubmit = true; };
    if(!okToSubmit) return "Using the browsers back button will cause you to lose all form data. Please use the Next and Back buttons on the form"; 
};
&lt;/script&gt;
</code></pre>

<p>Im using jAlert plug in for alerts and would like to use jConfirm for the function above. When I add jConfirm after "return" it works...for a second. it pops the warning and then the page refreshes and the dialog box goes away. Does anyone know how to fix this?</p>
