title: Adding href attribute to bootstrap button
body: <p>I'm trying to make it so that my button will open a url in a new tab.</p>
  
  <p>I can get it to work using window.location.href, but the url doesn't open in a new tab that way.</p>
  
  <p>I'm using jQuery and Javascript, and the code itself is inside of a larger jQuery function.</p>
  
  <pre><code>$('#code').click(function(){
      window.location.href = 'http://www.example.com'
  });
  </code></pre>
  
  <p>The button has no href attribute on page load.</p>
  
  <pre><code>&lt;button id="code" type="submit" class="btn btn-success" style="width:400px;"&gt;&lt;span class="glyphicon glyphicon-download"&gt;&lt;/span&gt; Generate Code&lt;/button&gt;
  </code></pre>
  
  <p>I've tried using .attr and .prop though it hasn't worked either. I'm kinda new to this stuff so I could've just done something wrong.</p>
  
  <p>I'm open to either adding an href to the button or using the .click function or whatever, I just need to get this to open to a new tab.</p>
  
  <p>Edit::
  Ok, more explanation.</p>
  
  <p>On Page load, the button onclick starts a timer that increments a progressbar. After the progressbar is done I want the button to open a link.</p>