title: preventDefault() overruled by window.location
body: <p>I have process in my website which contains a few steps. To navigate I have "previous" and "next" buttons. These buttons are <code>&lt;a&gt;</code> elements with an href attribute (to visit the previous and next step). </p>
  
  <p>The next button works as a door to the next step, but also to validate some fields in the current step, before it continues.</p>
  
  <p>So this is what happens when clicking the next button:</p>
  
  <ol>
  <li>The href value got saved in a variable <code>$url</code>.</li>
  <li><code>preventDefault()</code> prevents the link from opening the URL.</li>
  <li>There are some validation checks done.</li>
  <li>If they return "true", the <code>$url</code> will be loaded in window.location.</li>
  </ol>
  
  <p>For some steps I need to do another check to the user with a confirm box. But here comes the problem:</p>
  
  <p><strong>Problem:</strong></p>
  
  <p>When the <code>confirm()</code> returns "false", the user should not go to the next page. But the <code>window.location</code> of function 1 "overrules" the <code>preventDefault()</code> of function 2 now.</p>
  
  <p><strong>1. Default next button function:</strong></p>
  
  <pre><code>$('#next_link').click(function(e) {
      var url = $(this).attr('href');
      e.preventDefault();             
      if(wiz_validate_required() &amp;&amp; wiz_is_step_done()) {
          window.location = url;  
      } 
  }); 
  </code></pre>
  
  <p><strong>2. Confirm box function:</strong></p>
  
  <pre><code>$('.dimensions-check').click(function(e) {
      if(confirm('Have you specified the dimensions in millimeters?') == false) {
          e.preventDefault();
      }
  });
  </code></pre>