title: Redirect to href if javascript return true
body: <p>I have a <code>&lt;a&gt;</code> link and a checkbox, I want to redirect to the href only if the javascript returns true (the box is checked)</p>
  
  <p>Here is my code :</p>
  
  <p>My javascript file :</p>
  
  <pre><code>function fb_checkbox() {
      if (document.getElementById("checkAGB").checked == false) {
          document.getElementById('notAccepted').style.display = "block";
          return false;
      }else{
          return true;
      }
  </code></pre>
  
  <p>In my PHP file :</p>
  
  <pre><code>&lt;a href="'.$loginUrl.'" onclick="fb_checkbox();"&gt;Sign in with Facebook&lt;/a&gt;
  </code></pre>