title: Adding an if statement inside if statement
body: <p>I have a function for a button which submits a form. This function checks to see if the 5 checkboxes are selected  #co1,#co2,#co3,#div1,#cc1.</p>
  
  <p>It then also checks to see if tcaccept select is set to 1. 
  If so the form submits, else the alert pops up.</p>
  
  <p>This is the code i have at the moment:</p>
  
  <pre><code>  $('#submit2pd').click(function(event) {
      var $finishBoxes = $('#co1,#co2,#co3,#div1,#cc1');
  
          if (!($finishBoxes.length == $finishBoxes.filter(':checked').length &amp;&amp; $('#tcaccept').val() == '1' )) {
      alert('Please complete the Induction Checklist confirming that you have read and understood the Colleges main policies and procedures, agreeing to comply with these in line with the terms of your contract with the College');
              return false;
          }
  
          // otherwise the form is submitted
          window.location.href = "submit2pd.php";
  
      });
  </code></pre>
  
  <p>All works brilliantly, but i want to add to this line as i have another option that is required. But this needs to be an if statement.</p>
  
  <pre><code>    if (!($finishBoxes.length == $finishBoxes.filter(':checked').length &amp;&amp; $('#tcaccept').val() == '1' &amp;&amp; THE IF STATEMENT))
  </code></pre>
  
  <p>this is what i need to incorporate into the if statement above.</p>
  
  <pre><code>if ($("#ctl").val() == "1") {
  $('#ctlapp') must not be blank
  }
  else if ($("#ctl").val() == "0") {
  $('#ctlapp') can be blank
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>